mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-28 05:58:38 +02:00
feat(v2): docs last update timestamp and author (#1829)
* feat(v2): docs last update timestamp and author * misc(v2): changelog * misc(v2): better error messages
This commit is contained in:
parent
54e9e025d8
commit
4fe6ae3c24
12 changed files with 305 additions and 36 deletions
|
@ -14,6 +14,7 @@ import {LoadContext, Plugin, DocusaurusConfig} from '@docusaurus/types';
|
|||
import createOrder from './order';
|
||||
import loadSidebars from './sidebars';
|
||||
import processMetadata from './metadata';
|
||||
|
||||
import {
|
||||
PluginOptions,
|
||||
Sidebar,
|
||||
|
@ -41,6 +42,8 @@ const DEFAULT_OPTIONS: PluginOptions = {
|
|||
docItemComponent: '@theme/DocItem',
|
||||
remarkPlugins: [],
|
||||
rehypePlugins: [],
|
||||
showLastUpdateTime: false,
|
||||
showLastUpdateAuthor: false,
|
||||
};
|
||||
|
||||
export default function pluginContentDocs(
|
||||
|
@ -62,7 +65,14 @@ export default function pluginContentDocs(
|
|||
|
||||
// Fetches blog contents and returns metadata for the contents.
|
||||
async loadContent() {
|
||||
const {include, routeBasePath, sidebarPath, editUrl} = options;
|
||||
const {
|
||||
include,
|
||||
routeBasePath,
|
||||
sidebarPath,
|
||||
editUrl,
|
||||
showLastUpdateAuthor,
|
||||
showLastUpdateTime,
|
||||
} = options;
|
||||
const {siteConfig, siteDir} = context;
|
||||
const docsDir = contentPath;
|
||||
|
||||
|
@ -86,15 +96,17 @@ export default function pluginContentDocs(
|
|||
});
|
||||
await Promise.all(
|
||||
docsFiles.map(async source => {
|
||||
const metadata: MetadataRaw = await processMetadata(
|
||||
const metadata: MetadataRaw = await processMetadata({
|
||||
source,
|
||||
docsDir,
|
||||
order,
|
||||
siteConfig,
|
||||
routeBasePath,
|
||||
docsBasePath: routeBasePath,
|
||||
siteDir,
|
||||
editUrl,
|
||||
);
|
||||
showLastUpdateAuthor,
|
||||
showLastUpdateTime,
|
||||
});
|
||||
docsMetadataRaw[metadata.id] = metadata;
|
||||
}),
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue