Skip to content

Commit

Permalink
RSS feed
Browse files Browse the repository at this point in the history
For #21

- add <link> to make teh feed discoverable
  • Loading branch information
srl295 committed Aug 12, 2024
1 parent 1e5b4a7 commit 23b7fc5
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion .vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineConfig } from 'vitepress'
import { defineConfig, HeadConfig } from 'vitepress'
import footnote from 'markdown-it-footnote'
import { RSSOptions, RssPlugin } from 'vitepress-plugin-rss'

Expand All @@ -15,6 +15,25 @@ const RSS: RSSOptions = {

// https://vitepress.dev/reference/site-config
export default defineConfig({
transformHead: ({ pageData }) => {
const head: HeadConfig[] = []

if (pageData?.frontmatter?.title) {
head.push(['meta', { property: 'og:title', content: pageData.frontmatter.title }]);
}
if (pageData?.frontmatter?.description) {
head.push(['meta', { property: 'og:description', content: pageData.frontmatter.description }]);
}

// unconditionally add the RSS feed link
head.push(['link', {
rel: 'alternate',
type: 'application/rss+xml',
title: 'RSS',
href: 'https://codehivetx.us/feed.rss',
}]);
return head;
},
vite: {
plugins: [RssPlugin(RSS)],
},
Expand Down

0 comments on commit 23b7fc5

Please sign in to comment.