From fe1b6eab0ee404bbfe79cf6443d688ff6bcafb48 Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Fri, 30 Jun 2023 15:46:12 +0800 Subject: [PATCH] fix: enable cleanUrls & sitemap.xml & robots.txt --- docs/.vitepress/config.ts | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 79abca6..c0cbac0 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -47,16 +47,10 @@ export default defineConfig({ // remove trailing `.html` // https://vitepress.dev/guide/routing#generating-clean-url cleanUrls: true, + // Whether to get the last updated timestamp for each page using Git. + lastUpdated: true, - // sitemap.xml - transformHtml: (_, id, { pageData }) => { - if (!/[\\/]404\.html$/.test(id)) - links.push({ - // you might need to change this if not using clean urls mode - url: pageData.relativePath.replace(/((^|\/)index)?\.md$/, "$2.html"), - lastmod: pageData.lastUpdated, - }); - }, + // SEO Improvement - sitemap.xml & robots.txt buildEnd: async ({ outDir }) => { sitemap({ hostname: "https://nixos-and-flakes.thiscute.world/", @@ -65,7 +59,7 @@ export default defineConfig({ }); }, - // seo meta tags / JSON-LD + // SEO Improvement - JSON-LD transformPageData(pageData) { return { frontmatter: { @@ -83,7 +77,7 @@ export default defineConfig({ lineNumbers: true, config: (md) => { - // use more markdown-it plugins! + // add support for footnote md.use(require("markdown-it-footnote")); }, },