From 23b7fc5555115ceeb23e9e69fc7ac31004c1350f Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Mon, 12 Aug 2024 12:24:22 -0500 Subject: [PATCH] RSS feed For #21 - add to make teh feed discoverable --- .vitepress/config.mts | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.vitepress/config.mts b/.vitepress/config.mts index 6cd2fa0..6da817b 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -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' @@ -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)], },