mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Save sitemap as xml during build
This commit is contained in:
parent
fc8dd41f18
commit
915c1b0a3a
3 changed files with 34 additions and 3 deletions
25
helpers/api/sitemap/build.js
Normal file
25
helpers/api/sitemap/build.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// import fs from 'fs-extra'
|
||||
import { simpleSitemapAndIndex } from 'sitemap'
|
||||
|
||||
|
||||
import {
|
||||
sitemapLocation
|
||||
} from '~/helpers/constants.js'
|
||||
|
||||
export async function saveSitemap ( sitemapUrls ) {
|
||||
|
||||
await simpleSitemapAndIndex({
|
||||
hostname: process.env.PUBLIC_URL,
|
||||
destinationDir: sitemapLocation,
|
||||
gzip: false,
|
||||
// [{ url: '/page-1/', changefreq: 'daily'}, ...],
|
||||
sourceData: sitemapUrls.map( url => {
|
||||
return {
|
||||
url,
|
||||
// Google doesn't care about changefreq and priority - https://www.seroundtable.com/google-priority-change-frequency-xml-sitemap-20273.html
|
||||
// changefreq: 'daily'
|
||||
}
|
||||
}),
|
||||
})
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue