mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
25 lines
712 B
JavaScript
25 lines
712 B
JavaScript
// 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'
|
|
}
|
|
}),
|
|
})
|
|
|
|
}
|