Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions next-sitemap.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
/** @type {import('next-sitemap').IConfig} */
const path = require('path')
const glob = require('fast-glob')

module.exports = {
siteUrl: process.env.SITE_URL || 'https://docs.phase.dev',
generateRobotsTxt: true, // (optional)
siteUrl: process.env.CF_PAGES_URL || 'https://docs.phase.dev',
// We maintain robots.txt ourselves in public/robots.txt
generateRobotsTxt: false,
generateIndexSitemap: false,
outDir: 'public',
additionalPaths: async (config) => {
const pagesDir = path.join(process.cwd(), 'src', 'pages')
const files = glob.sync('**/*.mdx', {
cwd: pagesDir,
ignore: ['**/api/**'],
})
const urls = files
.map((file) => {
let route = '/' + file.replace(/\.mdx$/, '')
route = route.replace(/(^|\/)index$/, '') || '/'
return route
})
// Deduplicate and sort for stability
.filter((v, i, a) => a.indexOf(v) === i)
.sort()

return urls.map((loc) => ({ loc }))
},
}
281 changes: 159 additions & 122 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading