mirror of
https://github.com/ryan4yin/nixos-and-flakes-book
synced 2024-11-14 16:37:19 +00:00
fix: enable cleanUrls & sitemap.xml & robots.txt
This commit is contained in:
parent
5bdf1b81c7
commit
fe1b6eab0e
1 changed files with 5 additions and 11 deletions
|
@ -47,16 +47,10 @@ export default defineConfig({
|
||||||
// remove trailing `.html`
|
// remove trailing `.html`
|
||||||
// https://vitepress.dev/guide/routing#generating-clean-url
|
// https://vitepress.dev/guide/routing#generating-clean-url
|
||||||
cleanUrls: true,
|
cleanUrls: true,
|
||||||
|
// Whether to get the last updated timestamp for each page using Git.
|
||||||
|
lastUpdated: true,
|
||||||
|
|
||||||
// sitemap.xml
|
// SEO Improvement - sitemap.xml & robots.txt
|
||||||
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,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
buildEnd: async ({ outDir }) => {
|
buildEnd: async ({ outDir }) => {
|
||||||
sitemap({
|
sitemap({
|
||||||
hostname: "https://nixos-and-flakes.thiscute.world/",
|
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) {
|
transformPageData(pageData) {
|
||||||
return {
|
return {
|
||||||
frontmatter: {
|
frontmatter: {
|
||||||
|
@ -83,7 +77,7 @@ export default defineConfig({
|
||||||
lineNumbers: true,
|
lineNumbers: true,
|
||||||
|
|
||||||
config: (md) => {
|
config: (md) => {
|
||||||
// use more markdown-it plugins!
|
// add support for footnote
|
||||||
md.use(require("markdown-it-footnote"));
|
md.use(require("markdown-it-footnote"));
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue