@docusaurus/plugin-content-blog 0.0.0-4450 → 0.0.0-4452

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/index.js CHANGED
@@ -135,21 +135,23 @@ async function pluginContentBlog(context, options) {
135
135
  const sidebarBlogPosts = options.blogSidebarCount === 'ALL'
136
136
  ? blogPosts
137
137
  : blogPosts.slice(0, options.blogSidebarCount);
138
- const archiveUrl = (0, utils_1.normalizeUrl)([
139
- baseUrl,
140
- routeBasePath,
141
- archiveBasePath,
142
- ]);
143
- // creates a blog archive route
144
- const archiveProp = await createData(`${(0, utils_1.docuHash)(archiveUrl)}.json`, JSON.stringify({ blogPosts }, null, 2));
145
- addRoute({
146
- path: archiveUrl,
147
- component: '@theme/BlogArchivePage',
148
- exact: true,
149
- modules: {
150
- archive: aliasedSource(archiveProp),
151
- },
152
- });
138
+ if (archiveBasePath) {
139
+ const archiveUrl = (0, utils_1.normalizeUrl)([
140
+ baseUrl,
141
+ routeBasePath,
142
+ archiveBasePath,
143
+ ]);
144
+ // creates a blog archive route
145
+ const archiveProp = await createData(`${(0, utils_1.docuHash)(archiveUrl)}.json`, JSON.stringify({ blogPosts }, null, 2));
146
+ addRoute({
147
+ path: archiveUrl,
148
+ component: '@theme/BlogArchivePage',
149
+ exact: true,
150
+ modules: {
151
+ archive: aliasedSource(archiveProp),
152
+ },
153
+ });
154
+ }
153
155
  // This prop is useful to provide the blog list sidebar
154
156
  const sidebarProp = await createData(
155
157
  // Note that this created data path must be in sync with
@@ -40,7 +40,9 @@ exports.DEFAULT_OPTIONS = {
40
40
  };
41
41
  exports.PluginOptionSchema = utils_validation_1.Joi.object({
42
42
  path: utils_validation_1.Joi.string().default(exports.DEFAULT_OPTIONS.path),
43
- archiveBasePath: utils_validation_1.Joi.string().default(exports.DEFAULT_OPTIONS.archiveBasePath),
43
+ archiveBasePath: utils_validation_1.Joi.string()
44
+ .default(exports.DEFAULT_OPTIONS.archiveBasePath)
45
+ .allow(null),
44
46
  routeBasePath: utils_validation_1.Joi.string()
45
47
  // '' not allowed, see https://github.com/facebook/docusaurus/issues/3374
46
48
  // .allow('')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-content-blog",
3
- "version": "0.0.0-4450",
3
+ "version": "0.0.0-4452",
4
4
  "description": "Blog plugin for Docusaurus.",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/plugin-content-blog.d.ts",
@@ -18,11 +18,11 @@
18
18
  },
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@docusaurus/core": "0.0.0-4450",
22
- "@docusaurus/logger": "0.0.0-4450",
23
- "@docusaurus/mdx-loader": "0.0.0-4450",
24
- "@docusaurus/utils": "0.0.0-4450",
25
- "@docusaurus/utils-validation": "0.0.0-4450",
21
+ "@docusaurus/core": "0.0.0-4452",
22
+ "@docusaurus/logger": "0.0.0-4452",
23
+ "@docusaurus/mdx-loader": "0.0.0-4452",
24
+ "@docusaurus/utils": "0.0.0-4452",
25
+ "@docusaurus/utils-validation": "0.0.0-4452",
26
26
  "escape-string-regexp": "^4.0.0",
27
27
  "feed": "^4.2.2",
28
28
  "fs-extra": "^10.0.0",
@@ -36,7 +36,7 @@
36
36
  "webpack": "^5.61.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@docusaurus/types": "0.0.0-4450"
39
+ "@docusaurus/types": "0.0.0-4452"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": "^16.8.4 || ^17.0.0",
@@ -45,5 +45,5 @@
45
45
  "engines": {
46
46
  "node": ">=14"
47
47
  },
48
- "gitHead": "ec19750a6e41d9453cc95506d7827d299d76a89e"
48
+ "gitHead": "48cae5712e0a40d5f7e5c2669edcf2de8ae2533f"
49
49
  }
package/src/index.ts CHANGED
@@ -242,25 +242,26 @@ export default async function pluginContentBlog(
242
242
  ? blogPosts
243
243
  : blogPosts.slice(0, options.blogSidebarCount);
244
244
 
245
- const archiveUrl = normalizeUrl([
246
- baseUrl,
247
- routeBasePath,
248
- archiveBasePath,
249
- ]);
250
-
251
- // creates a blog archive route
252
- const archiveProp = await createData(
253
- `${docuHash(archiveUrl)}.json`,
254
- JSON.stringify({blogPosts}, null, 2),
255
- );
256
- addRoute({
257
- path: archiveUrl,
258
- component: '@theme/BlogArchivePage',
259
- exact: true,
260
- modules: {
261
- archive: aliasedSource(archiveProp),
262
- },
263
- });
245
+ if (archiveBasePath) {
246
+ const archiveUrl = normalizeUrl([
247
+ baseUrl,
248
+ routeBasePath,
249
+ archiveBasePath,
250
+ ]);
251
+ // creates a blog archive route
252
+ const archiveProp = await createData(
253
+ `${docuHash(archiveUrl)}.json`,
254
+ JSON.stringify({blogPosts}, null, 2),
255
+ );
256
+ addRoute({
257
+ path: archiveUrl,
258
+ component: '@theme/BlogArchivePage',
259
+ exact: true,
260
+ modules: {
261
+ archive: aliasedSource(archiveProp),
262
+ },
263
+ });
264
+ }
264
265
 
265
266
  // This prop is useful to provide the blog list sidebar
266
267
  const sidebarProp = await createData(
@@ -112,7 +112,7 @@ declare module '@docusaurus/plugin-content-blog' {
112
112
  path: string;
113
113
  routeBasePath: string;
114
114
  tagsBasePath: string;
115
- archiveBasePath: string;
115
+ archiveBasePath: string | null;
116
116
  include: string[];
117
117
  exclude: string[];
118
118
  postsPerPage: number | 'ALL';
@@ -47,7 +47,9 @@ export const DEFAULT_OPTIONS: PluginOptions = {
47
47
 
48
48
  export const PluginOptionSchema = Joi.object<PluginOptions>({
49
49
  path: Joi.string().default(DEFAULT_OPTIONS.path),
50
- archiveBasePath: Joi.string().default(DEFAULT_OPTIONS.archiveBasePath),
50
+ archiveBasePath: Joi.string()
51
+ .default(DEFAULT_OPTIONS.archiveBasePath)
52
+ .allow(null),
51
53
  routeBasePath: Joi.string()
52
54
  // '' not allowed, see https://github.com/facebook/docusaurus/issues/3374
53
55
  // .allow('')