Docs: Use built-in sitemap API instead

This commit is contained in:
SonMooSans
2024-01-01 20:34:28 +08:00
parent 8fd769fef0
commit 338ea98d9c
8 changed files with 57 additions and 83 deletions
+19
View File
@@ -0,0 +1,19 @@
---
'next-docs-zeta': minor
---
**Export `create` function for Contentlayer configuration**
If you want to include other document types, or override the output configuration, the `create` function can return the fields and document types you need.
```ts
import { create } from 'next-docs-zeta/contentlayer/configuration';
const config = create(options);
export default {
contentDirPath: config.contentDirPath,
documentTypes: [config.Docs, config.Meta],
mdx: config.mdx,
};
```
+4 -1
View File
@@ -7,5 +7,8 @@
"tailwindCSS.experimental.classRegex": [
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
["cn\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
]
],
"files.associations": {
"**/packages/create-next-docs/template/**/*": "plaintext"
}
}
-1
View File
@@ -1 +0,0 @@
enable-pre-post-scripts=true
+33
View File
@@ -0,0 +1,33 @@
import type { MetadataRoute } from 'next';
import { baseUrl } from '@/utils/metadata';
import { utils } from '@/utils/source';
export default function sitemap(): MetadataRoute.Sitemap {
const url = (path: string): string => new URL(path, baseUrl).toString();
return [
{
url: url('/'),
changeFrequency: 'monthly',
priority: 1,
},
{
url: url('/showcase'),
changeFrequency: 'monthly',
priority: 0.8,
},
{
url: url('/docs'),
changeFrequency: 'monthly',
priority: 0.8,
},
...utils.getPages().map<MetadataRoute.Sitemap[number]>((page) => ({
url: url(page.url),
lastModified: page.data.exports.lastModified
? new Date(page.data.exports.lastModified)
: undefined,
changeFrequency: 'weekly',
priority: 0.5,
})),
];
}
-5
View File
@@ -1,5 +0,0 @@
/** @type {import('next-sitemap').IConfig} */
module.exports = {
siteUrl: 'https://next-docs-zeta.vercel.app',
generateRobotsTxt: true,
};
-2
View File
@@ -4,7 +4,6 @@
"private": true,
"scripts": {
"build": "next build",
"postbuild": "next-sitemap & node ./update-index.mjs",
"build:shaders": "glslx shaders/rain.glsl --output=shaders/rain.min.js --format=js --renaming=internal-only",
"dev": "next dev",
"lint": "next lint",
@@ -22,7 +21,6 @@
"next-docs-mdx": "workspace:*",
"next-docs-ui": "workspace:*",
"next-docs-zeta": "workspace:*",
"next-sitemap": "^4.2.3",
"phenomenon": "^1.6.0",
"react": "18.2.0",
"react-dom": "18.2.0",
-3
View File
@@ -1,9 +1,6 @@
# *
User-agent: *
Allow: /
# Host
Host: https://next-docs-zeta.vercel.app
# Sitemaps
Sitemap: https://next-docs-zeta.vercel.app/sitemap.xml
+1 -71
View File
@@ -81,9 +81,6 @@ importers:
next-docs-zeta:
specifier: workspace:*
version: link:../../packages/headless
next-sitemap:
specifier: ^4.2.3
version: 4.2.3([email protected])
phenomenon:
specifier: ^1.6.0
version: 1.6.0
@@ -198,49 +195,6 @@ importers:
specifier: 5.3.3
version: 5.3.3
examples/my-app:
dependencies:
contentlayer:
specifier: 0.3.4
version: 0.3.4
next:
specifier: 14.0.4
version: 14.0.4(@babel/[email protected])([email protected])([email protected])
next-contentlayer:
specifier: 0.3.4
version: 0.3.4([email protected])([email protected])([email protected])([email protected])
next-docs-ui:
specifier: 6.1.0
version: link:../../packages/ui
next-docs-zeta:
specifier: 6.1.0
version: link:../../packages/headless
react:
specifier: 18.2.0
version: 18.2.0
react-dom:
specifier: 18.2.0
version: 18.2.0([email protected])
devDependencies:
'@types/react':
specifier: 18.2.0
version: 18.2.0
'@types/react-dom':
specifier: 18.2.1
version: 18.2.1
autoprefixer:
specifier: 10.4.16
version: 10.4.16([email protected])
postcss:
specifier: 8.4.32
version: 8.4.32
tailwindcss:
specifier: 3.3.7
version: 3.3.7
typescript:
specifier: 5.3.3
version: 5.3.3
examples/simple:
dependencies:
contentlayer:
@@ -1213,10 +1167,6 @@ packages:
ts-pattern: 4.3.0
type-fest: 3.13.1
/@corex/[email protected]:
resolution: {integrity: sha512-N8uEMrMPL0cu/bdboEWpQYb/0i2K5Qn8eCsxzOmxSggJbbQte7ljMRoXm917AbntqTGOzdTu+vP3KOOzoC70HQ==}
dev: false
/@effect-ts/[email protected]:
resolution: {integrity: sha512-qi1WrtJA90XLMnj2hnUszW9Sx4dXP03ZJtCc5DiUBIOhF4Vw7plfb65/bdBySPoC9s7zy995TdUX1XBSxUkl5w==}
dependencies:
@@ -1747,10 +1697,6 @@ packages:
- utf-8-validate
dev: true
/@next/[email protected]:
resolution: {integrity: sha512-Yac/bV5sBGkkEXmAX5FWPS9Mmo2rthrOPRQQNfycJPkjUAUclomCPH7QFVCDQ4Mp2k2K1SSM6m0zrxYrOwtFQw==}
dev: false
/@next/[email protected]:
resolution: {integrity: sha512-cIKhxkfVELB6hFjYsbtEeTus2mwrTC+JissfZYM0n+8Fv+g8ucUfOlm3VEDtwtwydZ0Nuauv3bl0qF82nnCAqA==}
dev: false
@@ -7911,6 +7857,7 @@ packages:
/[email protected]:
resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==}
dev: true
/[email protected]:
resolution: {integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==}
@@ -7996,23 +7943,6 @@ packages:
- supports-color
dev: false
/[email protected]([email protected]):
resolution: {integrity: sha512-vjdCxeDuWDzldhCnyFCQipw5bfpl4HmZA7uoo3GAaYGjGgfL4Cxb1CiztPuWGmS+auYs7/8OekRS8C2cjdAsjQ==}
engines: {node: '>=14.18'}
hasBin: true
peerDependencies:
next: '*'
peerDependenciesMeta:
next:
optional: true
dependencies:
'@corex/deepmerge': 4.0.43
'@next/env': 13.5.6
fast-glob: 3.3.2
minimist: 1.2.8
next: 14.0.4(@babel/[email protected])([email protected])([email protected])
dev: false
/[email protected]([email protected])([email protected])([email protected]):
resolution: {integrity: sha512-B+AKNfYNIzh0vqQQKqQItTS8evEouKD7H5Hj3kmuPERwddR2TxvDSFZuTj6T7Jfn1oyeUyJMydPl1Bkxkh0W7A==}
peerDependencies: