fix: sitemap format (#7453)
This commit is contained in:
parent
40b1e40721
commit
5fee3c6fdd
1780
public/sitemap.xml
1780
public/sitemap.xml
File diff suppressed because it is too large
Load Diff
@ -21,11 +21,11 @@ fs.readFile('./public/sitemap.xml', 'utf8', async (err, data) => {
|
||||
const sitemap = await parseStringPromise(data)
|
||||
if (sitemap.urlset.url) {
|
||||
sitemap.urlset.url.forEach((url) => {
|
||||
const lastMod = new Date(url['$'].lastmod).getTime()
|
||||
const lastMod = new Date(url.lastmod).getTime()
|
||||
if (lastMod < Date.now() - weekMs) {
|
||||
url['$'].lastmod = nowISO
|
||||
url.lastmod = nowISO
|
||||
}
|
||||
sitemapURLs[url['$']['loc']] = true
|
||||
sitemapURLs[url.loc] = true
|
||||
})
|
||||
}
|
||||
|
||||
@ -45,11 +45,9 @@ fs.readFile('./public/sitemap.xml', 'utf8', async (err, data) => {
|
||||
const tokenURL = `https://app.uniswap.org/tokens/${chainName.toLowerCase()}/${address}`
|
||||
if (!(tokenURL in sitemapURLs)) {
|
||||
sitemap.urlset.url.push({
|
||||
$: {
|
||||
loc: [tokenURL],
|
||||
lastmod: [nowISO],
|
||||
priority: [0.8],
|
||||
},
|
||||
loc: [tokenURL],
|
||||
lastmod: [nowISO],
|
||||
priority: [0.8],
|
||||
})
|
||||
}
|
||||
})
|
||||
|
@ -9,7 +9,7 @@ describe('Routes', () => {
|
||||
const contents = fs.readFileSync('./public/sitemap.xml', 'utf8')
|
||||
const sitemap = await parseStringPromise(contents)
|
||||
|
||||
const sitemapPaths: string[] = sitemap.urlset.url.map((url: any) => new URL(url['$'].loc).pathname)
|
||||
const sitemapPaths: string[] = sitemap.urlset.url.map((url: any) => new URL(url.loc).pathname)
|
||||
|
||||
sitemapPaths
|
||||
.filter((p) => !p.includes('/0x'))
|
||||
|
Loading…
Reference in New Issue
Block a user