@docusaurus/plugin-content-pages 3.7.0 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/content.js +6 -5
- package/lib/frontMatter.js +1 -0
- package/package.json +7 -7
- package/src/content.ts +9 -5
- package/src/frontMatter.ts +1 -0
- package/src/plugin-content-pages.d.ts +10 -1
package/lib/content.js
CHANGED
|
@@ -55,12 +55,11 @@ async function processPageSourceFile(relativeSource, params) {
|
|
|
55
55
|
const contentPath = await (0, utils_1.getFolderContainingFile)(getContentPathList(contentPaths), relativeSource);
|
|
56
56
|
const source = path_1.default.join(contentPath, relativeSource);
|
|
57
57
|
const aliasedSourcePath = (0, utils_1.aliasedSitePath)(source, siteDir);
|
|
58
|
-
const
|
|
59
|
-
baseUrl,
|
|
60
|
-
options.routeBasePath,
|
|
61
|
-
(0, utils_1.encodePath)((0, utils_1.fileToPath)(relativeSource)),
|
|
62
|
-
]);
|
|
58
|
+
const filenameSlug = (0, utils_1.encodePath)((0, utils_1.fileToPath)(relativeSource));
|
|
63
59
|
if (!isMarkdownSource(relativeSource)) {
|
|
60
|
+
// For now, slug can't be customized for JSX pages
|
|
61
|
+
const slug = filenameSlug;
|
|
62
|
+
const permalink = (0, utils_1.normalizeUrl)([baseUrl, options.routeBasePath, slug]);
|
|
64
63
|
return {
|
|
65
64
|
type: 'jsx',
|
|
66
65
|
permalink,
|
|
@@ -74,6 +73,8 @@ async function processPageSourceFile(relativeSource, params) {
|
|
|
74
73
|
parseFrontMatter: siteConfig.markdown.parseFrontMatter,
|
|
75
74
|
});
|
|
76
75
|
const frontMatter = (0, frontMatter_1.validatePageFrontMatter)(unsafeFrontMatter);
|
|
76
|
+
const slug = frontMatter.slug ?? filenameSlug;
|
|
77
|
+
const permalink = (0, utils_1.normalizeUrl)([baseUrl, options.routeBasePath, slug]);
|
|
77
78
|
const pagesDirPath = await (0, utils_1.getFolderContainingFile)(getContentPathList(contentPaths), relativeSource);
|
|
78
79
|
const pagesSourceAbsolute = path_1.default.join(pagesDirPath, relativeSource);
|
|
79
80
|
function getPagesEditUrl() {
|
package/lib/frontMatter.js
CHANGED
|
@@ -15,6 +15,7 @@ const PageFrontMatterSchema = utils_validation_1.Joi.object({
|
|
|
15
15
|
description: utils_validation_1.Joi.string().allow(''),
|
|
16
16
|
keywords: utils_validation_1.Joi.array().items(utils_validation_1.Joi.string().required()),
|
|
17
17
|
image: utils_validation_1.URISchema,
|
|
18
|
+
slug: utils_validation_1.Joi.string(),
|
|
18
19
|
wrapperClassName: utils_validation_1.Joi.string(),
|
|
19
20
|
hide_table_of_contents: utils_validation_1.Joi.boolean(),
|
|
20
21
|
...utils_validation_1.FrontMatterTOCHeadingLevels,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-content-pages",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "Pages plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/plugin-content-pages.d.ts",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@docusaurus/core": "3.
|
|
22
|
-
"@docusaurus/mdx-loader": "3.
|
|
23
|
-
"@docusaurus/types": "3.
|
|
24
|
-
"@docusaurus/utils": "3.
|
|
25
|
-
"@docusaurus/utils-validation": "3.
|
|
21
|
+
"@docusaurus/core": "3.8.0",
|
|
22
|
+
"@docusaurus/mdx-loader": "3.8.0",
|
|
23
|
+
"@docusaurus/types": "3.8.0",
|
|
24
|
+
"@docusaurus/utils": "3.8.0",
|
|
25
|
+
"@docusaurus/utils-validation": "3.8.0",
|
|
26
26
|
"fs-extra": "^11.1.1",
|
|
27
27
|
"tslib": "^2.6.0",
|
|
28
28
|
"webpack": "^5.88.1"
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"engines": {
|
|
35
35
|
"node": ">=18.0"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "948d63c42fad0ba24b7b531a9deb6167e64dc845"
|
|
38
38
|
}
|
package/src/content.ts
CHANGED
|
@@ -106,12 +106,13 @@ async function processPageSourceFile(
|
|
|
106
106
|
|
|
107
107
|
const source = path.join(contentPath, relativeSource);
|
|
108
108
|
const aliasedSourcePath = aliasedSitePath(source, siteDir);
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
encodePath(fileToPath(relativeSource)),
|
|
113
|
-
]);
|
|
109
|
+
|
|
110
|
+
const filenameSlug = encodePath(fileToPath(relativeSource));
|
|
111
|
+
|
|
114
112
|
if (!isMarkdownSource(relativeSource)) {
|
|
113
|
+
// For now, slug can't be customized for JSX pages
|
|
114
|
+
const slug = filenameSlug;
|
|
115
|
+
const permalink = normalizeUrl([baseUrl, options.routeBasePath, slug]);
|
|
115
116
|
return {
|
|
116
117
|
type: 'jsx',
|
|
117
118
|
permalink,
|
|
@@ -131,6 +132,9 @@ async function processPageSourceFile(
|
|
|
131
132
|
});
|
|
132
133
|
const frontMatter = validatePageFrontMatter(unsafeFrontMatter);
|
|
133
134
|
|
|
135
|
+
const slug = frontMatter.slug ?? filenameSlug;
|
|
136
|
+
const permalink = normalizeUrl([baseUrl, options.routeBasePath, slug]);
|
|
137
|
+
|
|
134
138
|
const pagesDirPath = await getFolderContainingFile(
|
|
135
139
|
getContentPathList(contentPaths),
|
|
136
140
|
relativeSource,
|
package/src/frontMatter.ts
CHANGED
|
@@ -22,6 +22,7 @@ const PageFrontMatterSchema = Joi.object<PageFrontMatter>({
|
|
|
22
22
|
description: Joi.string().allow(''),
|
|
23
23
|
keywords: Joi.array().items(Joi.string().required()),
|
|
24
24
|
image: URISchema,
|
|
25
|
+
slug: Joi.string(),
|
|
25
26
|
wrapperClassName: Joi.string(),
|
|
26
27
|
hide_table_of_contents: Joi.boolean(),
|
|
27
28
|
...FrontMatterTOCHeadingLevels,
|
|
@@ -7,7 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
declare module '@docusaurus/plugin-content-pages' {
|
|
9
9
|
import type {MDXOptions} from '@docusaurus/mdx-loader';
|
|
10
|
-
import type {
|
|
10
|
+
import type {
|
|
11
|
+
LoadContext,
|
|
12
|
+
Plugin,
|
|
13
|
+
OptionValidationContext,
|
|
14
|
+
} from '@docusaurus/types';
|
|
11
15
|
import type {FrontMatterLastUpdate, LastUpdateData} from '@docusaurus/utils';
|
|
12
16
|
|
|
13
17
|
export type Assets = {
|
|
@@ -33,6 +37,7 @@ declare module '@docusaurus/plugin-content-pages' {
|
|
|
33
37
|
readonly title?: string;
|
|
34
38
|
readonly description?: string;
|
|
35
39
|
readonly image?: string;
|
|
40
|
+
readonly slug?: string;
|
|
36
41
|
readonly keywords?: string[];
|
|
37
42
|
readonly wrapperClassName?: string;
|
|
38
43
|
readonly hide_table_of_contents?: string;
|
|
@@ -82,6 +87,10 @@ declare module '@docusaurus/plugin-content-pages' {
|
|
|
82
87
|
context: LoadContext,
|
|
83
88
|
options: PluginOptions,
|
|
84
89
|
): Promise<Plugin<LoadedContent | null>>;
|
|
90
|
+
|
|
91
|
+
export function validateOptions(
|
|
92
|
+
args: OptionValidationContext<Options | undefined, PluginOptions>,
|
|
93
|
+
): PluginOptions;
|
|
85
94
|
}
|
|
86
95
|
|
|
87
96
|
declare module '@theme/MDXPage' {
|