@docusaurus/plugin-content-blog 3.3.1 → 3.4.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/blogUtils.d.ts +1 -9
- package/lib/blogUtils.js +17 -22
- package/lib/feed.d.ts +5 -1
- package/lib/feed.js +44 -1
- package/lib/index.js +109 -101
- package/lib/markdownLoader.js +2 -6
- package/lib/options.js +9 -0
- package/lib/props.js +2 -0
- package/lib/types.d.ts +1 -8
- package/package.json +9 -9
- package/src/blogUtils.ts +21 -43
- package/src/feed.ts +57 -1
- package/src/index.ts +151 -136
- package/src/markdownLoader.ts +3 -7
- package/src/options.ts +9 -0
- package/src/plugin-content-blog.d.ts +102 -101
- package/src/props.ts +2 -0
- package/src/types.ts +1 -6
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
7
|
/// <reference types="@docusaurus/module-type-aliases" />
|
|
9
8
|
|
|
10
9
|
declare module '@docusaurus/plugin-content-blog' {
|
|
@@ -12,9 +11,10 @@ declare module '@docusaurus/plugin-content-blog' {
|
|
|
12
11
|
import type {MDXOptions} from '@docusaurus/mdx-loader';
|
|
13
12
|
import type {
|
|
14
13
|
FrontMatterTag,
|
|
15
|
-
|
|
14
|
+
TagMetadata,
|
|
16
15
|
LastUpdateData,
|
|
17
16
|
FrontMatterLastUpdate,
|
|
17
|
+
TagsPluginOptions,
|
|
18
18
|
} from '@docusaurus/utils';
|
|
19
19
|
import type {DocusaurusConfig, Plugin, LoadContext} from '@docusaurus/types';
|
|
20
20
|
import type {Item as FeedItem} from 'feed';
|
|
@@ -236,7 +236,7 @@ yarn workspace v1.22.19image` is a collocated image path, this entry will be the
|
|
|
236
236
|
/** Front matter, as-is. */
|
|
237
237
|
readonly frontMatter: BlogPostFrontMatter & {[key: string]: unknown};
|
|
238
238
|
/** Tags, normalized. */
|
|
239
|
-
readonly tags:
|
|
239
|
+
readonly tags: TagMetadata[];
|
|
240
240
|
/**
|
|
241
241
|
* Marks the post as unlisted and visibly hides it unless directly accessed.
|
|
242
242
|
*/
|
|
@@ -345,103 +345,104 @@ yarn workspace v1.22.19image` is a collocated image path, this entry will be the
|
|
|
345
345
|
/**
|
|
346
346
|
* Plugin options after normalization.
|
|
347
347
|
*/
|
|
348
|
-
export type PluginOptions = MDXOptions &
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
348
|
+
export type PluginOptions = MDXOptions &
|
|
349
|
+
TagsPluginOptions & {
|
|
350
|
+
/** Plugin ID. */
|
|
351
|
+
id?: string;
|
|
352
|
+
/**
|
|
353
|
+
* Path to the blog content directory on the file system, relative to site
|
|
354
|
+
* directory.
|
|
355
|
+
*/
|
|
356
|
+
path: string;
|
|
357
|
+
/**
|
|
358
|
+
* URL route for the blog section of your site. **DO NOT** include a
|
|
359
|
+
* trailing slash. Use `/` to put the blog at root path.
|
|
360
|
+
*/
|
|
361
|
+
routeBasePath: string;
|
|
362
|
+
/**
|
|
363
|
+
* URL route for the tags section of your blog. Will be appended to
|
|
364
|
+
* `routeBasePath`.
|
|
365
|
+
*/
|
|
366
|
+
tagsBasePath: string;
|
|
367
|
+
/**
|
|
368
|
+
* URL route for the pages section of your blog. Will be appended to
|
|
369
|
+
* `routeBasePath`.
|
|
370
|
+
*/
|
|
371
|
+
pageBasePath: string;
|
|
372
|
+
/**
|
|
373
|
+
* URL route for the archive section of your blog. Will be appended to
|
|
374
|
+
* `routeBasePath`. **DO NOT** include a trailing slash. Use `null` to
|
|
375
|
+
* disable generation of archive.
|
|
376
|
+
*/
|
|
377
|
+
archiveBasePath: string | null;
|
|
378
|
+
/**
|
|
379
|
+
* Array of glob patterns matching Markdown files to be built, relative to
|
|
380
|
+
* the content path.
|
|
381
|
+
*/
|
|
382
|
+
include: string[];
|
|
383
|
+
/**
|
|
384
|
+
* Array of glob patterns matching Markdown files to be excluded. Serves as
|
|
385
|
+
* refinement based on the `include` option.
|
|
386
|
+
*/
|
|
387
|
+
exclude: string[];
|
|
388
|
+
/**
|
|
389
|
+
* Number of posts to show per page in the listing page. Use `'ALL'` to
|
|
390
|
+
* display all posts on one listing page.
|
|
391
|
+
*/
|
|
392
|
+
postsPerPage: number | 'ALL';
|
|
393
|
+
/** Root component of the blog listing page. */
|
|
394
|
+
blogListComponent: string;
|
|
395
|
+
/** Root component of each blog post page. */
|
|
396
|
+
blogPostComponent: string;
|
|
397
|
+
/** Root component of the tags list page. */
|
|
398
|
+
blogTagsListComponent: string;
|
|
399
|
+
/** Root component of the "posts containing tag" page. */
|
|
400
|
+
blogTagsPostsComponent: string;
|
|
401
|
+
/** Root component of the blog archive page. */
|
|
402
|
+
blogArchiveComponent: string;
|
|
403
|
+
/** Blog page title for better SEO. */
|
|
404
|
+
blogTitle: string;
|
|
405
|
+
/** Blog page meta description for better SEO. */
|
|
406
|
+
blogDescription: string;
|
|
407
|
+
/**
|
|
408
|
+
* Number of blog post elements to show in the blog sidebar. `'ALL'` to show
|
|
409
|
+
* all blog posts; `0` to disable.
|
|
410
|
+
*/
|
|
411
|
+
blogSidebarCount: number | 'ALL';
|
|
412
|
+
/** Title of the blog sidebar. */
|
|
413
|
+
blogSidebarTitle: string;
|
|
414
|
+
/** Truncate marker marking where the summary ends. */
|
|
415
|
+
truncateMarker: RegExp;
|
|
416
|
+
/** Show estimated reading time for the blog post. */
|
|
417
|
+
showReadingTime: boolean;
|
|
418
|
+
/** Blog feed. */
|
|
419
|
+
feedOptions: FeedOptions;
|
|
420
|
+
/**
|
|
421
|
+
* Base URL to edit your site. The final URL is computed by `editUrl +
|
|
422
|
+
* relativePostPath`. Using a function allows more nuanced control for each
|
|
423
|
+
* file. Omitting this variable entirely will disable edit links.
|
|
424
|
+
*/
|
|
425
|
+
editUrl?: string | EditUrlFunction;
|
|
426
|
+
/**
|
|
427
|
+
* The edit URL will target the localized file, instead of the original
|
|
428
|
+
* unlocalized file. Ignored when `editUrl` is a function.
|
|
429
|
+
*/
|
|
430
|
+
editLocalizedFiles?: boolean;
|
|
431
|
+
/** Path to the authors map file, relative to the blog content directory. */
|
|
432
|
+
authorsMapPath: string;
|
|
433
|
+
/** A callback to customize the reading time number displayed. */
|
|
434
|
+
readingTime: ReadingTimeFunctionOption;
|
|
435
|
+
/** Governs the direction of blog post sorting. */
|
|
436
|
+
sortPosts: 'ascending' | 'descending';
|
|
437
|
+
/** Whether to display the last date the doc was updated. */
|
|
438
|
+
showLastUpdateTime: boolean;
|
|
439
|
+
/** Whether to display the author who last updated the doc. */
|
|
440
|
+
showLastUpdateAuthor: boolean;
|
|
441
|
+
/** An optional function which can be used to transform blog posts
|
|
442
|
+
* (filter, modify, delete, etc...).
|
|
443
|
+
*/
|
|
444
|
+
processBlogPosts: ProcessBlogPostsFn;
|
|
445
|
+
};
|
|
445
446
|
|
|
446
447
|
/**
|
|
447
448
|
* Feed options, as provided by user config. `type` accepts `all` as shortcut
|
|
@@ -494,7 +495,7 @@ yarn workspace v1.22.19image` is a collocated image path, this entry will be the
|
|
|
494
495
|
[permalink: string]: BlogTag;
|
|
495
496
|
};
|
|
496
497
|
|
|
497
|
-
export type BlogTag =
|
|
498
|
+
export type BlogTag = TagMetadata & {
|
|
498
499
|
/** Blog post permalinks. */
|
|
499
500
|
items: string[];
|
|
500
501
|
pages: BlogPaginated[];
|
package/src/props.ts
CHANGED
|
@@ -13,6 +13,7 @@ export function toTagsProp({blogTags}: {blogTags: BlogTags}): TagsListItem[] {
|
|
|
13
13
|
.map((tag) => ({
|
|
14
14
|
label: tag.label,
|
|
15
15
|
permalink: tag.permalink,
|
|
16
|
+
description: tag.description,
|
|
16
17
|
count: tag.items.length,
|
|
17
18
|
}));
|
|
18
19
|
}
|
|
@@ -27,6 +28,7 @@ export function toTagProp({
|
|
|
27
28
|
return {
|
|
28
29
|
label: tag.label,
|
|
29
30
|
permalink: tag.permalink,
|
|
31
|
+
description: tag.description,
|
|
30
32
|
allTagsPath: blogTagsListPath,
|
|
31
33
|
count: tag.items.length,
|
|
32
34
|
unlisted: tag.unlisted,
|
package/src/types.ts
CHANGED
|
@@ -5,15 +5,10 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type {
|
|
8
|
+
import type {ContentPaths} from '@docusaurus/utils';
|
|
9
9
|
|
|
10
10
|
export type BlogContentPaths = ContentPaths;
|
|
11
11
|
|
|
12
|
-
export type BlogBrokenMarkdownLink = BrokenMarkdownLink<BlogContentPaths>;
|
|
13
12
|
export type BlogMarkdownLoaderOptions = {
|
|
14
|
-
siteDir: string;
|
|
15
|
-
contentPaths: BlogContentPaths;
|
|
16
13
|
truncateMarker: RegExp;
|
|
17
|
-
sourceToPermalink: {[aliasedPath: string]: string};
|
|
18
|
-
onBrokenMarkdownLink: (brokenMarkdownLink: BlogBrokenMarkdownLink) => void;
|
|
19
14
|
};
|