@docusaurus/plugin-content-blog 0.0.0-4441 → 0.0.0-4449

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/blogUtils.js CHANGED
@@ -33,16 +33,15 @@ function getBlogTags(blogPosts) {
33
33
  }));
34
34
  }
35
35
  exports.getBlogTags = getBlogTags;
36
- const DATE_FILENAME_REGEX = /^(?<date>\d{4}[-/]\d{1,2}[-/]\d{1,2})[-/]?(?<text>.*?)(\/index)?.mdx?$/;
36
+ const DATE_FILENAME_REGEX = /^(?<folder>.*)(?<date>\d{4}[-/]\d{1,2}[-/]\d{1,2})[-/]?(?<text>.*?)(\/index)?.mdx?$/;
37
37
  function parseBlogFileName(blogSourceRelative) {
38
38
  const dateFilenameMatch = blogSourceRelative.match(DATE_FILENAME_REGEX);
39
39
  if (dateFilenameMatch) {
40
- const dateString = dateFilenameMatch.groups.date;
41
- const text = dateFilenameMatch.groups.text;
40
+ const { folder, text, date: dateString } = dateFilenameMatch.groups;
42
41
  // Always treat dates as UTC by adding the `Z`
43
42
  const date = new Date(`${dateString}Z`);
44
43
  const slugDate = dateString.replace(/-/g, '/');
45
- const slug = `/${slugDate}/${text}`;
44
+ const slug = `/${slugDate}/${folder}${text}`;
46
45
  return { date, text, slug };
47
46
  }
48
47
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-content-blog",
3
- "version": "0.0.0-4441",
3
+ "version": "0.0.0-4449",
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-4441",
22
- "@docusaurus/logger": "0.0.0-4441",
23
- "@docusaurus/mdx-loader": "0.0.0-4441",
24
- "@docusaurus/utils": "0.0.0-4441",
25
- "@docusaurus/utils-validation": "0.0.0-4441",
21
+ "@docusaurus/core": "0.0.0-4449",
22
+ "@docusaurus/logger": "0.0.0-4449",
23
+ "@docusaurus/mdx-loader": "0.0.0-4449",
24
+ "@docusaurus/utils": "0.0.0-4449",
25
+ "@docusaurus/utils-validation": "0.0.0-4449",
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-4441"
39
+ "@docusaurus/types": "0.0.0-4449"
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": "43dbd283d8dbcab6ce2f3b1d2ebc0fe0334c77c9"
48
+ "gitHead": "45c2cbd06d5b7b76e182d70bebdf2b0777b59d30"
49
49
  }
package/src/blogUtils.ts CHANGED
@@ -63,7 +63,7 @@ export function getBlogTags(blogPosts: BlogPost[]): BlogTags {
63
63
  }
64
64
 
65
65
  const DATE_FILENAME_REGEX =
66
- /^(?<date>\d{4}[-/]\d{1,2}[-/]\d{1,2})[-/]?(?<text>.*?)(\/index)?.mdx?$/;
66
+ /^(?<folder>.*)(?<date>\d{4}[-/]\d{1,2}[-/]\d{1,2})[-/]?(?<text>.*?)(\/index)?.mdx?$/;
67
67
 
68
68
  type ParsedBlogFileName = {
69
69
  date: Date | undefined;
@@ -76,12 +76,11 @@ export function parseBlogFileName(
76
76
  ): ParsedBlogFileName {
77
77
  const dateFilenameMatch = blogSourceRelative.match(DATE_FILENAME_REGEX);
78
78
  if (dateFilenameMatch) {
79
- const dateString = dateFilenameMatch.groups!.date!;
80
- const text = dateFilenameMatch.groups!.text!;
79
+ const {folder, text, date: dateString} = dateFilenameMatch.groups!;
81
80
  // Always treat dates as UTC by adding the `Z`
82
81
  const date = new Date(`${dateString}Z`);
83
82
  const slugDate = dateString.replace(/-/g, '/');
84
- const slug = `/${slugDate}/${text}`;
83
+ const slug = `/${slugDate}/${folder}${text}`;
85
84
  return {date, text, slug};
86
85
  } else {
87
86
  const text = blogSourceRelative.replace(/(\/index)?\.mdx?$/, '');