File tree Expand file tree Collapse file tree 4 files changed +15
-3
lines changed Expand file tree Collapse file tree 4 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 11module . exports = {
22 dest : 'vuepress' ,
33 sitemap : {
4- domain : 'https://vuepress.vuejs.org'
4+ domain : 'https://vuepress.vuejs.org' ,
5+ filename : 'test.xml'
56 } ,
67 locales : {
78 '/' : {
Original file line number Diff line number Diff line change @@ -198,6 +198,12 @@ module.exports = {
198198 }
199199}
200200```
201+ ### sitemap
202+
203+ - Type: ` Object `
204+ - Default: ` undefined `
205+
206+ Defined sitemap option
201207
202208## Browser Compatibility
203209
Original file line number Diff line number Diff line change @@ -157,7 +157,8 @@ async function resolveOptions (sourceDir) {
157157 const data = {
158158 path : fileToPath ( file )
159159 }
160-
160+ const f = await fs . stat ( path . resolve ( sourceDir , file ) )
161+ data . lastModified = new Date ( f . mtime ) . toISOString ( )
161162 // extract yaml frontmatter
162163 const content = await fs . readFile ( path . resolve ( sourceDir , file ) , 'utf-8' )
163164 const frontmatter = yaml . loadFront ( content )
Original file line number Diff line number Diff line change @@ -2,9 +2,13 @@ const { fileNameConverter } = require('./index')
22
33function xmlFormatter ( options ) {
44 const content = options . siteData . pages . reduce ( ( prev , current ) => {
5+ console . log ( JSON . stringify ( current , null , 2 ) )
56 const filename = fileNameConverter ( current . path )
67 const url = options . siteConfig . sitemap . domain + options . siteData . base + filename
7- return prev + `<url><loc>${ url } </loc></url>`
8+ return prev + `<url>
9+ <loc>${ url } </loc>
10+ <lastmod>${ current . lastModified } </lastmod>
11+ </url>`
812 } , '' )
913 return `<?xml version="1.0" encoding="UTF-8"?>
1014<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
You can’t perform that action at this time.
0 commit comments