11import { defineConfig } from 'vitepress'
2+ import { SitemapStream } from 'sitemap'
3+ import { createWriteStream } from 'node:fs'
4+ import { resolve } from 'node:path'
25
36// https://vitepress.dev/reference/site-config
47export default defineConfig ( {
58 title : "PS4 Linux Tutorial" ,
69 description : "A simple and modern guide on how to install Linux on PS4 systems." ,
710 base : "/ps4-linux-tutorial/" ,
8- sitemap : {
9- hostname : 'https://dionkill.github.io/ps4-linux-tutorial/'
10- } ,
1111
1212 // Metadata and favicon
1313 head : [
@@ -33,6 +33,24 @@ export default defineConfig({
3333 [ 'meta' , { name : 'twitter:image' , content : 'https://dionkill.github.io/ps4-linux-tutorial/preview.png' } ] ,
3434 ] ,
3535
36+ buildEnd : async ( { outDir } ) => {
37+ const sitemap = new SitemapStream ( { hostname : 'https://dionkill.github.io/ps4-linux-tutorial/' } )
38+ const pages = await createContentLoader ( '*.md' ) . load ( )
39+ const writeStream = createWriteStream ( resolve ( outDir , 'sitemap.xml' ) )
40+
41+ sitemap . pipe ( writeStream )
42+ pages . forEach ( ( page ) => sitemap . write (
43+ page . url
44+ // If `cleanUrls is enabled`
45+ . replace ( / i n d e x $ / g, '' )
46+ // Optional: if Markdown files are located in a subfolder
47+ . replace ( / ^ \/ d o c s / , '' )
48+ ) )
49+ sitemap . end ( )
50+
51+ await new Promise ( ( r ) => writeStream . on ( 'finish' , r ) )
52+ } ,
53+
3654 // Theme configuration
3755 themeConfig : {
3856 // https://vitepress.dev/reference/default-theme-config
@@ -215,6 +233,7 @@ export default defineConfig({
215233 ] ,
216234
217235 // Custom added stuff
236+ cleanUrls : 'true' ,
218237
219238 socialLinks : [
220239 { icon : 'github' , link : 'https://github.com/DionKill/ps4-linux-tutorial/' }
0 commit comments