diff --git a/vitepress/.vitepress/config.mjs b/vitepress/.vitepress/config.mjs index ed813b0..b363415 100644 --- a/vitepress/.vitepress/config.mjs +++ b/vitepress/.vitepress/config.mjs @@ -1,9 +1,12 @@ import { defineConfig } from 'vitepress' import { rss } from './rss.mjs' +const APP_URL = `https://blog.mehdi.cc` +const APP_TITLE = 'Mehdi’s Notes' + // https://vitepress.dev/reference/site-config export default defineConfig({ - title: 'Mehdi’s Notes', + title: APP_TITLE, description: 'Content for your web-enthusiast brain, by Mehdi Merah.', lang: 'en', cleanUrls: true, // https://vitepress.dev/guide/routing#generating-clean-url @@ -12,7 +15,8 @@ export default defineConfig({ buildEnd: rss, head: [ - ['meta', { name:'color-scheme', content:'dark light only' }] + ['meta', { name: 'color-scheme', content: 'dark light only' }], + ['link', { rel: 'alternate', type: 'application/rss+xml', title: APP_TITLE, href: `${APP_URL}/feed.rss` }] ], themeConfig: { @@ -22,6 +26,7 @@ export default defineConfig({ { text: 'Articles', link: '/articles' }, { text: 'Notes', link: '/notes' }, { text: 'About', link: '/about' }, + { text: 'RSS', link: '/feed.rss' }, ], // sidebar: [ diff --git a/vitepress/.vitepress/rss.mjs b/vitepress/.vitepress/rss.mjs index 0d22c0d..cf9ba1f 100644 --- a/vitepress/.vitepress/rss.mjs +++ b/vitepress/.vitepress/rss.mjs @@ -5,7 +5,7 @@ import { createContentLoader } from 'vitepress' import { comparePublicationDate, isPublished } from './utils/frontmatter.mjs' /** @todo: should come from .env */ -const baseUrl = `https://blog.mehdi.cc` +const APP_URL = `https://blog.mehdi.cc` /** * @param {import('vitepress').SiteConfig} config @@ -17,14 +17,14 @@ export async function rss(config) { */ const feed = new Feed({ docs: 'https://www.rssboard.org/rss-specification', - link: baseUrl + 'link', + link: APP_URL + 'link', title: config.site.title, description: config.site.description, language: config.site.lang, // image: 'https://blog.mehdi.cc/file.png', - // favicon: `${baseUrl}/favicon.ico`, + // favicon: `${APP_URL}/favicon.ico`, copyright: 'Copyright © 2023-present, Mehdi Merah', - feed: `${baseUrl}/feed.rss`, + feed: `${APP_URL}/feed.rss`, ttl: 2880, // 1 day, }); @@ -34,8 +34,8 @@ export async function rss(config) { .forEach(({ url, excerpt, frontmatter, html }) => feed.addItem({ title: frontmatter.title, - id: `${baseUrl}${url}`, - link: `${baseUrl}${url}`, + id: `${APP_URL}${url}`, + link: `${APP_URL}${url}`, description: frontmatter.description || excerpt, content: html, date: frontmatter.publishedAt, diff --git a/vitepress/.vitepress/theme/index.js b/vitepress/.vitepress/theme/index.js index bd72433..4057957 100644 --- a/vitepress/.vitepress/theme/index.js +++ b/vitepress/.vitepress/theme/index.js @@ -1,10 +1,10 @@ import './custom.css' import DefaultTheme from 'vitepress/theme' -import NotesIndex from './NotesIndex.vue' +// import NotesIndex from './NotesIndex.vue' export default { extends: DefaultTheme, - enhanceApp({ app }) { - app.component('notes-index', NotesIndex) - } + // enhanceApp({ app }) { + // app.component('notes-index', NotesIndex) + // } }