add tag routes to sitemap

This commit is contained in:
Timothy 2021-01-13 20:17:09 +08:00
parent 1c2f40424b
commit 9965355e45
3 changed files with 4 additions and 5 deletions

View file

@ -26,10 +26,6 @@ module.exports = withBundleAnalyzer({
use: ['@svgr/webpack'],
})
if (!dev && isServer) {
require('./scripts/generate-sitemap')
}
if (!dev && !isServer) {
// Replace React with Preact only in client production build
Object.assign(config.resolve.alias, {

View file

@ -5,7 +5,7 @@
"scripts": {
"start": "next dev",
"dev": "next dev",
"build": "next build",
"build": "next build && node ./scripts/generate-sitemap",
"serve": "next start",
"analyze": "ANALYZE=true next build"
},

View file

@ -9,6 +9,7 @@ const siteMetadata = require('../data/siteMetadata')
'pages/*.js',
'data/**/*.mdx',
'data/**/*.md',
'public/tags/**/*.xml',
'!pages/_*.js',
'!pages/api',
])
@ -21,9 +22,11 @@ const siteMetadata = require('../data/siteMetadata')
const path = page
.replace('pages', '')
.replace('data', '')
.replace('public', '')
.replace('.js', '')
.replace('.mdx', '')
.replace('.md', '')
.replace('/index.xml', '')
const route = path === '/index' ? '' : path
return `
<url>