summaryrefslogtreecommitdiffstats
path: root/docs/content/en/methods/page
diff options
context:
space:
mode:
Diffstat (limited to 'docs/content/en/methods/page')
-rw-r--r--docs/content/en/methods/page/Data.md2
-rw-r--r--docs/content/en/methods/page/Description.md2
-rw-r--r--docs/content/en/methods/page/Eq.md4
-rw-r--r--docs/content/en/methods/page/Fragments.md4
-rw-r--r--docs/content/en/methods/page/GetPage.md4
-rw-r--r--docs/content/en/methods/page/GitInfo.md16
-rw-r--r--docs/content/en/methods/page/HasShortcode.md4
-rw-r--r--docs/content/en/methods/page/Layout.md13
-rw-r--r--docs/content/en/methods/page/Page.md6
-rw-r--r--docs/content/en/methods/page/Paginate.md4
-rw-r--r--docs/content/en/methods/page/Paginator.md4
-rw-r--r--docs/content/en/methods/page/Render.md25
-rw-r--r--docs/content/en/methods/page/RenderShortcodes.md4
-rw-r--r--docs/content/en/methods/page/RenderString.md2
-rw-r--r--docs/content/en/methods/page/Sitemap.md2
-rw-r--r--docs/content/en/methods/page/TableOfContents.md4
-rw-r--r--docs/content/en/methods/page/Title.md15
17 files changed, 68 insertions, 47 deletions
diff --git a/docs/content/en/methods/page/Data.md b/docs/content/en/methods/page/Data.md
index ae0bdc57f..bb88dbde6 100644
--- a/docs/content/en/methods/page/Data.md
+++ b/docs/content/en/methods/page/Data.md
@@ -14,7 +14,7 @@ The `Data` method on a `Page` object returns a unique data object for each [page
> [!note]
> The `Data` method is only useful within [taxonomy](g) and [term](g) templates.
>
-> Themes that are not actively maintained may still use `.Data.Pages` in list templates. Although that syntax remains functional, use one of these methods instead: [`Pages`], [`RegularPages`], or [`RegularPagesRecursive`]
+> Themes that are not actively maintained may still use `.Data.Pages` in their templates. Although that syntax remains functional, use one of these methods instead: [`Pages`], [`RegularPages`], or [`RegularPagesRecursive`]
The examples that follow are based on this site configuration:
diff --git a/docs/content/en/methods/page/Description.md b/docs/content/en/methods/page/Description.md
index 5287aa699..7a609bb07 100644
--- a/docs/content/en/methods/page/Description.md
+++ b/docs/content/en/methods/page/Description.md
@@ -16,7 +16,7 @@ title = 'How to make spicy tuna hand rolls'
description = 'Instructions for making spicy tuna hand rolls.'
{{< /code-toggle >}}
-```go-html-template {file="layouts/_default/baseof.html"}
+```go-html-template {file="layouts/baseof.html"}
<head>
...
<meta name="description" content="{{ .Description }}">
diff --git a/docs/content/en/methods/page/Eq.md b/docs/content/en/methods/page/Eq.md
index 4947a4bfa..0cfe1f1f7 100644
--- a/docs/content/en/methods/page/Eq.md
+++ b/docs/content/en/methods/page/Eq.md
@@ -9,9 +9,9 @@ params:
signatures: [PAGE1.Eq PAGE2]
---
-In this contrived example from a single template, we list all pages in the current section except for the current page.
+In this contrived example we list all pages in the current section except for the current page.
-```go-html-template
+```go-html-template {file="layouts/page.html"}
{{ $currentPage := . }}
{{ range .CurrentSection.Pages }}
{{ if not (.Eq $currentPage) }}
diff --git a/docs/content/en/methods/page/Fragments.md b/docs/content/en/methods/page/Fragments.md
index 2c0460def..1b30ac973 100644
--- a/docs/content/en/methods/page/Fragments.md
+++ b/docs/content/en/methods/page/Fragments.md
@@ -102,8 +102,8 @@ Hugo renders this to:
> When using the `Fragments` methods within a shortcode, call the shortcode using [standard notation]. If you use [Markdown notation] the rendered shortcode is included in the creation of the fragments map, resulting in a circular loop.
[`TableOfContents`]: /methods/page/tableofcontents/
-[ATX]: https://spec.commonmark.org/0.30/#atx-headings
+[ATX]: https://spec.commonmark.org/current/#atx-headings
[Markdown notation]: /content-management/shortcodes/#notation
-[setext]: https://spec.commonmark.org/0.30/#setext-headings
+[setext]: https://spec.commonmark.org/current/#setext-headings
[standard notation]: /content-management/shortcodes/#notation
[table of contents]: /methods/page/tableofcontents/
diff --git a/docs/content/en/methods/page/GetPage.md b/docs/content/en/methods/page/GetPage.md
index 02f6888e0..7c1e45dd9 100644
--- a/docs/content/en/methods/page/GetPage.md
+++ b/docs/content/en/methods/page/GetPage.md
@@ -35,9 +35,9 @@ content/
└── _index.md
```
-The examples below depict the result of rendering works/paintings/the-mona-lisa.md:
+The examples below depict the result of rendering `works/paintings/the-mona-lisa.md`:
-```go-html-template {file="layouts/works/single.html"}
+```go-html-template {file="layouts/works/page.html"}
{{ with .GetPage "starry-night" }}
{{ .Title }} → Starry Night
{{ end }}
diff --git a/docs/content/en/methods/page/GitInfo.md b/docs/content/en/methods/page/GitInfo.md
index 5fde05b07..90dc3870a 100644
--- a/docs/content/en/methods/page/GitInfo.md
+++ b/docs/content/en/methods/page/GitInfo.md
@@ -117,6 +117,22 @@ hugo --enableGitInfo
{{ end }}
```
+### Ancestors
+
+(`*source.GitInfo`) The file-filtered ancestor commits, if any.
+
+```go-html-template
+{{ with .GitInfo }}
+ {{ range .Ancestors | first 5 }}
+ {{ .CommitDate.Format "2006-01-02" }}: {{ .Subject }}
+ {{ end }}
+{{ end }}
+```
+
+### Parent
+
+(`*source.GitInfo`) The first file-filtered ancestor commit, if any.
+
## Last modified date
By default, when `enableGitInfo` is `true`, the `Lastmod` method on a `Page` object returns the Git AuthorDate of the last commit that included the file.
diff --git a/docs/content/en/methods/page/HasShortcode.md b/docs/content/en/methods/page/HasShortcode.md
index 616b6de09..2e585da31 100644
--- a/docs/content/en/methods/page/HasShortcode.md
+++ b/docs/content/en/methods/page/HasShortcode.md
@@ -29,7 +29,7 @@ By example, let's use [Plotly] to render a chart:
The shortcode is simple:
-```go-html-template {file="layouts/shortcodes/plotly.html"}
+```go-html-template {file="layouts/_shortcodes/plotly.html"}
{{ $id := printf "plotly-%02d" .Ordinal }}
<div id="{{ $id }}"></div>
<script>
@@ -39,7 +39,7 @@ The shortcode is simple:
Now we can selectively load the required JavaScript on pages that call the "plotly" shortcode:
-```go-html-template {file="layouts/_default/baseof.html"}
+```go-html-template {file="layouts/baseof.html"}
<head>
...
{{ if .HasShortcode "plotly" }}
diff --git a/docs/content/en/methods/page/Layout.md b/docs/content/en/methods/page/Layout.md
index f9aa5b6ab..e038f3837 100644
--- a/docs/content/en/methods/page/Layout.md
+++ b/docs/content/en/methods/page/Layout.md
@@ -22,12 +22,13 @@ Hugo will render the page using contact.html.
```text
layouts/
-└── _default/
- ├── baseof.html
- ├── contact.html
- ├── home.html
- ├── list.html
- └── single.html
+├── baseof.html
+├── contact.html
+├── home.html
+├── page.html
+├── section.html
+├── taxonomy.html
+└── term.html
```
Although rarely used within a template, you can access the value with:
diff --git a/docs/content/en/methods/page/Page.md b/docs/content/en/methods/page/Page.md
index 7c7728b2f..01abb3103 100644
--- a/docs/content/en/methods/page/Page.md
+++ b/docs/content/en/methods/page/Page.md
@@ -11,19 +11,19 @@ params:
This is a convenience method, useful within partial templates that are called from both [shortcodes](g) and page templates.
-```go-html-template {file="layouts/shortcodes/foo.html"}
+```go-html-template {file="layouts/_shortcodes/foo.html"}
{{ partial "my-partial.html" . }}
```
When the shortcode calls the partial, it passes the current [context](g) (the dot). The context includes identifiers such as `Page`, `Params`, `Inner`, and `Name`.
-```go-html-template {file="layouts/_default/single.html"}
+```go-html-template {file="layouts/page.html"}
{{ partial "my-partial.html" . }}
```
When the page template calls the partial, it also passes the current context (the dot). But in this case, the dot _is_ the `Page` object.
-```go-html-template {file="layouts/partials/my-partial.html"}
+```go-html-template {file="layouts/_partials/my-partial.html"}
The page title is: {{ .Page.Title }}
```
diff --git a/docs/content/en/methods/page/Paginate.md b/docs/content/en/methods/page/Paginate.md
index 0b699d6b2..7792980e6 100644
--- a/docs/content/en/methods/page/Paginate.md
+++ b/docs/content/en/methods/page/Paginate.md
@@ -20,13 +20,13 @@ By default, the number of elements on each pager is determined by your [site con
You can invoke pagination on the [home template], [section templates], [taxonomy templates], and [term templates].
-```go-html-template {file="layouts/_default/list.html"}
+```go-html-template {file="layouts/section.html"}
{{ $pages := where .Site.RegularPages "Section" "articles" }}
{{ $pages = $pages.ByTitle }}
{{ range (.Paginate $pages 7).Pages }}
<h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
{{ end }}
-{{ template "_internal/pagination.html" . }}
+{{ partial "pagination.html" . }}
```
In the example above, we:
diff --git a/docs/content/en/methods/page/Paginator.md b/docs/content/en/methods/page/Paginator.md
index bff7ea90c..1518ac95d 100644
--- a/docs/content/en/methods/page/Paginator.md
+++ b/docs/content/en/methods/page/Paginator.md
@@ -15,11 +15,11 @@ The number of elements on each pager is determined by your [site configuration].
You can invoke pagination on the [home template], [section templates], [taxonomy templates], and [term templates]. Each of these receives a collection of regular pages in [context](g). When you invoke the `Paginator` method, it paginates the page collection received in context.
-```go-html-template {file="layouts/_default/list.html"}
+```go-html-template {file="layouts/section.html"}
{{ range .Paginator.Pages }}
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ end }}
-{{ template "_internal/pagination.html" . }}
+{{ partial "pagination.html" . }}
```
In the example above, the embedded pagination template creates navigation links between pagers.
diff --git a/docs/content/en/methods/page/Render.md b/docs/content/en/methods/page/Render.md
index 10f7f9ca5..4ee09fb6e 100644
--- a/docs/content/en/methods/page/Render.md
+++ b/docs/content/en/methods/page/Render.md
@@ -26,22 +26,21 @@ Although similar to the [`partial`] function, there are key differences.
`Render` method|`partial` function|
:--|:--
The `Page` object is automatically passed to the given template. You cannot pass additional context.| You must specify the context, allowing you to pass a combination of objects, slices, maps, and scalars.
-The path to the template is determined by the [content type](g).|You must specify the path to the template, relative to the `layouts/partials` directory.
+The path to the template is determined by the [content type](g).|You must specify the path to the template, relative to the `layouts/_partials` directory.
Consider this layout structure:
```text
layouts/
-├── _default/
-│ ├── baseof.html
-│ ├── home.html
-│ ├── li.html <-- used for other content types
-│ ├── list.html
-│ ├── single.html
-│ └── summary.html
-└── books/
- ├── li.html <-- used when content type is "books"
- └── summary.html
+├── books/
+│ └── li.html <-- used when content type is "books"
+├── baseof.html
+├── home.html
+├── li.html <-- used for other content types
+├── page.html
+├── section.html
+├── taxonomy.html
+└── term.html
```
And this template:
@@ -63,10 +62,10 @@ layouts/books/li.html
For all other content types the `Render` methods calls:
```text
-layouts/_default/li.html
+layouts/li.html
```
See [content views] for more examples.
-[content views]: /templates/content-view/
+[content views]: /templates/types/#content-view
[`partial`]: /functions/partials/include/
diff --git a/docs/content/en/methods/page/RenderShortcodes.md b/docs/content/en/methods/page/RenderShortcodes.md
index d124606f0..81a78b04b 100644
--- a/docs/content/en/methods/page/RenderShortcodes.md
+++ b/docs/content/en/methods/page/RenderShortcodes.md
@@ -9,13 +9,11 @@ params:
signatures: [PAGE.RenderShortcodes]
---
-{{< new-in 0.117.0 />}}
-
Use this method in shortcode templates to compose a page from multiple content files, while preserving a global context for footnotes and the table of contents.
For example:
-```go-html-template {file="layouts/shortcodes/include.html" copy=true}
+```go-html-template {file="layouts/_shortcodes/include.html" copy=true}
{{ with .Get 0 }}
{{ with $.Page.GetPage . }}
{{- .RenderShortcodes }}
diff --git a/docs/content/en/methods/page/RenderString.md b/docs/content/en/methods/page/RenderString.md
index c7774774c..5f97e3576 100644
--- a/docs/content/en/methods/page/RenderString.md
+++ b/docs/content/en/methods/page/RenderString.md
@@ -46,4 +46,4 @@ Render with [Pandoc]:
```
[markup identifier]: /content-management/formats/#classification
-[pandoc]: https://www.pandoc.org/
+[pandoc]: https://pandoc.org/
diff --git a/docs/content/en/methods/page/Sitemap.md b/docs/content/en/methods/page/Sitemap.md
index bb1360493..3a4f2ad62 100644
--- a/docs/content/en/methods/page/Sitemap.md
+++ b/docs/content/en/methods/page/Sitemap.md
@@ -58,7 +58,7 @@ changeFreq = 'hourly'
And this simplistic sitemap template:
-```xml {file="layouts/_default/sitemap.xml"}
+```xml {file="layouts/sitemap.xml"}
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
diff --git a/docs/content/en/methods/page/TableOfContents.md b/docs/content/en/methods/page/TableOfContents.md
index 7ec9fe614..f44d660ae 100644
--- a/docs/content/en/methods/page/TableOfContents.md
+++ b/docs/content/en/methods/page/TableOfContents.md
@@ -12,8 +12,8 @@ aliases: [/content-management/toc/]
The `TableOfContents` method on a `Page` object returns an ordered or unordered list of the Markdown [ATX] and [setext] headings within the page content.
-[atx]: https://spec.commonmark.org/0.30/#atx-headings
-[setext]: https://spec.commonmark.org/0.30/#setext-headings
+[atx]: https://spec.commonmark.org/current/#atx-headings
+[setext]: https://spec.commonmark.org/current/#setext-headings
This template code:
diff --git a/docs/content/en/methods/page/Title.md b/docs/content/en/methods/page/Title.md
index dae4ba6dd..2201266a7 100644
--- a/docs/content/en/methods/page/Title.md
+++ b/docs/content/en/methods/page/Title.md
@@ -19,7 +19,16 @@ title = 'About us'
{{ .Title }} → About us
```
-With section, taxonomy, and term pages not backed by a file, the `Title` method returns the section name, capitalized and pluralized. You can disable these transformations by setting [`capitalizeListTitles`] and [`pluralizeListTitles`] in your site configuration. For example:
+When a page is not backed by a file, the value returned by the `Title` method depends on the page [kind](g).
+
+Page kind|Page title when the page is not backed by a file
+:--|:--
+home|site title
+section|section name (capitalized and pluralized)
+taxonomy|taxonomy name (capitalized and pluralized)
+term|term name (capitalized and pluralized)
+
+You can disable automatic capitalization and pluralization in your site configuration:
{{< code-toggle file=hugo >}}
capitalizeListTitles = false
@@ -32,8 +41,6 @@ You can change the capitalization style in your site configuration to one of `ap
titleCaseStyle = "firstupper"
{{< /code-toggle >}}
- See&nbsp;[details].
+See&nbsp;[details].
-[`capitalizeListTitles`]: /configuration/all/#capitalizelisttitles
-[`pluralizeListTitles`]: /configuration/all/#pluralizelisttitles
[details]: /configuration/all/#title-case-style