Skip to main content

content-hook

TL;DR

Connects the directory with the documentation files.

After the hook registration, the *.md[x] files in the directory will be added to the documentation application as separate pages and for each of them a route will be generated depending on the path in the file system relative to the root directory and the file name.

Because the route generation is automatic, it is best to avoid using other than Latin letters in file and directory names, if you want to apply custom display settings, you need to use formatting from content.

Integration:

1. Add dependency

yarn add -WD "@docusaurus-tde/content-hook"

2. Connect the hook

docusaurus-tde.config.js
const path = require('path')

module.exports = {
hooks: [
['@docusaurus-tde/content-hook', { contentDir: path.join(__dirname, 'content') }],
]
}

3. Initialize the directory structure.

Execute the command

yarn docusaurus-tde create --structure

4. Start the application.

Execute the command

yarn docusaurus-tde start

Available hook options:

type contentHookProps = {
contentDir: string;
id?: string; // 'default'
routeBasePath?: string; // '/'
showLastUpdateAuthor?: boolean; // true
showLastUpdateTime?: boolean; // true
}