Skip to content

Commit 68d3eb0

Browse files
Merge pull request #185 from phasehq/feat--markdown-docs
feat: generate markdown docs from mdx
2 parents ec5c9ee + 708b1f4 commit 68d3eb0

File tree

172 files changed

+15401
-287
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+15401
-287
lines changed

next-sitemap.config.js

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,29 @@
11
/** @type {import('next-sitemap').IConfig} */
2+
const path = require('path')
3+
const glob = require('fast-glob')
4+
25
module.exports = {
3-
siteUrl: process.env.SITE_URL || 'https://docs.phase.dev',
4-
generateRobotsTxt: true, // (optional)
6+
siteUrl: process.env.CF_PAGES_URL || 'https://docs.phase.dev',
7+
// We maintain robots.txt ourselves in public/robots.txt
8+
generateRobotsTxt: false,
59
generateIndexSitemap: false,
10+
outDir: 'public',
11+
additionalPaths: async (config) => {
12+
const pagesDir = path.join(process.cwd(), 'src', 'pages')
13+
const files = glob.sync('**/*.mdx', {
14+
cwd: pagesDir,
15+
ignore: ['**/api/**'],
16+
})
17+
const urls = files
18+
.map((file) => {
19+
let route = '/' + file.replace(/\.mdx$/, '')
20+
route = route.replace(/(^|\/)index$/, '') || '/'
21+
return route
22+
})
23+
// Deduplicate and sort for stability
24+
.filter((v, i, a) => a.indexOf(v) === i)
25+
.sort()
26+
27+
return urls.map((loc) => ({ loc }))
28+
},
629
}

package-lock.json

Lines changed: 159 additions & 122 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)