diff options
Diffstat (limited to 'content/en/content-management/sections.md')
-rw-r--r-- | content/en/content-management/sections.md | 70 |
1 files changed, 34 insertions, 36 deletions
diff --git a/content/en/content-management/sections.md b/content/en/content-management/sections.md index a3e4397f3..1b694ce44 100644 --- a/content/en/content-management/sections.md +++ b/content/en/content-management/sections.md @@ -8,8 +8,8 @@ menu: docs: parent: content-management weight: 120 -toc: true weight: 120 +toc: true aliases: [/content/sections/] --- @@ -26,35 +26,35 @@ A typical site consists of one or more sections. For example: ```text content/ ├── articles/ <-- section (top-level directory) -│ ├── 2022/ -│ │ ├── article-1/ -│ │ │ ├── cover.jpg -│ │ │ └── index.md -│ │ └── article-2.md -│ └── 2023/ -│ ├── article-3.md -│ └── article-4.md +│ ├── 2022/ +│ │ ├── article-1/ +│ │ │ ├── cover.jpg +│ │ │ └── index.md +│ │ └── article-2.md +│ └── 2023/ +│ ├── article-3.md +│ └── article-4.md ├── products/ <-- section (top-level directory) -│ ├── product-1/ <-- section (has _index.md file) -│ │ ├── benefits/ <-- section (has _index.md file) -│ │ │ ├── _index.md -│ │ │ ├── benefit-1.md -│ │ │ └── benefit-2.md -│ │ ├── features/ <-- section (has _index.md file) -│ │ │ ├── _index.md -│ │ │ ├── feature-1.md -│ │ │ └── feature-2.md -│ │ └── _index.md -│ └── product-2/ <-- section (has _index.md file) -│ ├── benefits/ <-- section (has _index.md file) -│ │ ├── _index.md -│ │ ├── benefit-1.md -│ │ └── benefit-2.md -│ ├── features/ <-- section (has _index.md file) -│ │ ├── _index.md -│ │ ├── feature-1.md -│ │ └── feature-2.md -│ └── _index.md +│ ├── product-1/ <-- section (has _index.md file) +│ │ ├── benefits/ <-- section (has _index.md file) +│ │ │ ├── _index.md +│ │ │ ├── benefit-1.md +│ │ │ └── benefit-2.md +│ │ ├── features/ <-- section (has _index.md file) +│ │ │ ├── _index.md +│ │ │ ├── feature-1.md +│ │ │ └── feature-2.md +│ │ └── _index.md +│ └── product-2/ <-- section (has _index.md file) +│ ├── benefits/ <-- section (has _index.md file) +│ │ ├── _index.md +│ │ ├── benefit-1.md +│ │ └── benefit-2.md +│ ├── features/ <-- section (has _index.md file) +│ │ ├── _index.md +│ │ ├── feature-1.md +│ │ └── feature-2.md +│ └── _index.md ├── _index.md └── about.md ``` @@ -77,7 +77,7 @@ With the file structure from the [example above](#overview): 1. The articles/2022 and articles/2023 directories do not have list pages; they are not sections. -1. The list page for the products section, by default, includes product-1 and product-2, but not their descendant pages. To include descendant pages, use the `.RegularPagesRecursive` collection instead of the `.Pages` collection in the list template. See [details](/variables/page/#page-collections). +1. The list page for the products section, by default, includes product-1 and product-2, but not their descendant pages. To include descendant pages, use the `.RegularPagesRecursive` collection instead of the `.Pages` collection in the list template. See [details](/variables/page/#page-collections). 1. All directories in the products section have list pages; each directory is a section. @@ -106,8 +106,7 @@ If you need to use a different template for a subsection, specify `type` and/or ## Ancestors and descendants -A section has one or more ancestors (including the home page), and zero or more descendants. With the file structure from the [example above](#overview): - +A section has one or more ancestors (including the home page), and zero or more descendants. With the file structure from the [example above](#overview): ```text content/products/product-1/benefits/benefit-1.md @@ -117,16 +116,16 @@ The content file (benefit-1.md) has four ancestors: benefits, product-1, product For example, use the `.Ancestors` method to render breadcrumb navigation. -{{< code file="layouts/partials/breadcrumb.html" >}} +{{< code file=layouts/partials/breadcrumb.html >}} <nav aria-label="breadcrumb" class="breadcrumb"> <ol> {{ range .Ancestors.Reverse }} <li> - <a href="{{ .Permalink }}">{{ .LinkTitle }}</a> + <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a> </li> {{ end }} <li class="active"> - <a aria-current="page" href="{{ .Permalink }}">{{ .LinkTitle }}</a> + <a aria-current="page" href="{{ .RelPermalink }}">{{ .LinkTitle }}</a> </li> </ol> </nav> @@ -154,7 +153,6 @@ Hugo renders this, where each breadcrumb is a link to the corresponding page: Home » Products » Product 1 » Benefits » Benefit 1 ``` - [archetype]: /content-management/archetypes/ [content type]: /content-management/types/ [directory structure]: /getting-started/directory-structure/ |