跳过正文

Docs Layout

首次發表:

Yore provides a docs layout for deep documentation. It uses a 3-column structure with a section sidebar, content area, and on-page table of contents.

Setup

Directory-based

Place your Markdown files under content/docs/. Hugo automatically assigns the docs type to all pages in that directory.

cascade

To apply the docs layout to paths outside content/docs/, use cascade. Set it in hugo.yaml to target arbitrary path patterns, or in a section's _index.md to scope it to that section.

hugo.yaml
cascade:
  - type: docs
    target:
      path: '{/shortcodes,/shortcodes/**}'
content/shortcodes/_index.md
---
title: Shortcode Section
cascade:
  type: docs
---

Options

Section (_index.md)

FieldDescription
params.docsNavCollapsedCollapses the section navigation by default when set to true
linkTitleShort title displayed in the docs sidebar instead of the full page title

Page (index.md)

FieldDescription
params.docsIconIcon shown next to the entry in the docs sidebar
params.docsIconClassCSS classes applied to the icon wrapper element
params.sourceLinksList of source file links displayed at the bottom of the page. See below.
linkTitleShort title displayed in the docs sidebar instead of the full page title

Each entry in params.sourceLinks is a map with the following fields.

FieldDescription
pathRelative path to the source file. Combined with site.Params.sourceBaseURL to build the URL.
urlAbsolute URL to the source file. Takes precedence over path when both are set.
labelDisplay label for the link. Defaults to the file name from path or url.

Acknowledgement

A large part of Yore's docs layout is built upon the solid foundation of Docusaurus.

文章关联