diff options
Diffstat (limited to 'docs/content/en/methods')
34 files changed, 98 insertions, 77 deletions
diff --git a/docs/content/en/methods/menu-entry/PageRef.md b/docs/content/en/methods/menu-entry/PageRef.md index 979879b03..5fc2dfcae 100644 --- a/docs/content/en/methods/menu-entry/PageRef.md +++ b/docs/content/en/methods/menu-entry/PageRef.md @@ -62,7 +62,7 @@ weight = 20 With this template code: -```go-html-template {file="layouts/partials/menu.html"} +```go-html-template {file="layouts/_partials/menu.html"} <ul> {{ range .Site.Menus.main }} <li><a href="{{ .URL }}">{{ .Name }}</a></li> @@ -83,7 +83,7 @@ In the above note that the `href` attribute of the second `anchor` element is bl With this template code: -```go-html-template {file="layouts/partials/menu.html"} +```go-html-template {file="layouts/_partials/menu.html"} <ul> {{ range .Site.Menus.main }} <li><a href="{{ or .URL .PageRef }}">{{ .Name }}</a></li> 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 [details]. +See [details]. -[`capitalizeListTitles`]: /configuration/all/#capitalizelisttitles -[`pluralizeListTitles`]: /configuration/all/#pluralizelisttitles [details]: /configuration/all/#title-case-style diff --git a/docs/content/en/methods/pager/PageGroups.md b/docs/content/en/methods/pager/PageGroups.md index 46f6d81cb..df668ddd2 100644 --- a/docs/content/en/methods/pager/PageGroups.md +++ b/docs/content/en/methods/pager/PageGroups.md @@ -24,5 +24,5 @@ Use the `PageGroups` method with any of the [grouping methods]. {{ end }} {{ end }} -{{ template "_internal/pagination.html" . }} +{{ partial "pagination.html" . }} ``` diff --git a/docs/content/en/methods/pager/Pages.md b/docs/content/en/methods/pager/Pages.md index 6e5772a48..bb5ac927a 100644 --- a/docs/content/en/methods/pager/Pages.md +++ b/docs/content/en/methods/pager/Pages.md @@ -17,5 +17,5 @@ params: <h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2> {{ end }} -{{ template "_internal/pagination.html" . }} +{{ partial "pagination.html" . }} ``` diff --git a/docs/content/en/methods/pages/Related.md b/docs/content/en/methods/pages/Related.md index 22eeb4dfa..6d3859560 100644 --- a/docs/content/en/methods/pages/Related.md +++ b/docs/content/en/methods/pages/Related.md @@ -15,7 +15,7 @@ Based on front matter, Hugo uses several factors to identify content related to The argument passed to the `Related` method may be a `Page` or an options map. For example, to pass the current page: -```go-html-template {file="layouts/_default/single.html"} +```go-html-template {file="layouts/page.html"} {{ with .Site.RegularPages.Related . | first 5 }} <p>Related pages:</p> <ul> @@ -28,7 +28,7 @@ The argument passed to the `Related` method may be a `Page` or an options map. F To pass an options map: -```go-html-template {file="layouts/_default/single.html"} +```go-html-template {file="layouts/page.html"} {{ $opts := dict "document" . "indices" (slice "tags" "keywords") diff --git a/docs/content/en/methods/resource/ResourceType.md b/docs/content/en/methods/resource/ResourceType.md index 0ea9c0cf9..70dc59108 100644 --- a/docs/content/en/methods/resource/ResourceType.md +++ b/docs/content/en/methods/resource/ResourceType.md @@ -36,7 +36,7 @@ content/ With the structure above, we can range through page resources of type `page` to build content: -```go-html-template {file="layouts/lessons/single.html"} +```go-html-template {file="layouts/lessons/page.html"} {{ range .Resources.ByType "page" }} {{ .Content }} {{ end }} diff --git a/docs/content/en/methods/shortcode/Get.md b/docs/content/en/methods/shortcode/Get.md index b9c01cfc4..aef9987f0 100644 --- a/docs/content/en/methods/shortcode/Get.md +++ b/docs/content/en/methods/shortcode/Get.md @@ -24,7 +24,7 @@ This shortcode call uses positional arguments: To retrieve arguments by position: -```go-html-template {file="layouts/shortcodes/myshortcode.html"} +```go-html-template {file="layouts/_shortcodes/myshortcode.html"} {{ printf "%s %s." (.Get 0) (.Get 1) }} → Hello world. ``` @@ -38,7 +38,7 @@ This shortcode call uses named arguments: To retrieve arguments by name: -```go-html-template {file="layouts/shortcodes/myshortcode.html"} +```go-html-template {file="layouts/_shortcodes/myshortcode.html"} {{ printf "%s %s." (.Get "greeting") (.Get "firstName") }} → Hello world. ``` diff --git a/docs/content/en/methods/shortcode/Inner.md b/docs/content/en/methods/shortcode/Inner.md index cdce4c1c3..bb5a16a01 100644 --- a/docs/content/en/methods/shortcode/Inner.md +++ b/docs/content/en/methods/shortcode/Inner.md @@ -19,7 +19,7 @@ We design the **best** widgets in the world. With this shortcode: -```go-html-template {file="layouts/shortcodes/card.html"} +```go-html-template {file="layouts/_shortcodes/card.html"} <div class="card"> {{ with .Get "title" }} <div class="card-title">{{ . }}</div> @@ -51,7 +51,7 @@ Is rendered to: Let's modify the example above to pass the value returned by `Inner` through the [`RenderString`] method on the `Page` object: -```go-html-template {file="layouts/shortcodes/card.html"} +```go-html-template {file="layouts/_shortcodes/card.html"} <div class="card"> {{ with .Get "title" }} <div class="card-title">{{ . }}</div> @@ -98,7 +98,7 @@ This configuration is not unsafe if _you_ control the content. Read more about H Second, because we are rendering the entire shortcode as Markdown, we must adhere to the rules governing [indentation] and inclusion of [raw HTML blocks] as provided in the [CommonMark] specification. -```go-html-template {file="layouts/shortcodes/card.html"} +```go-html-template {file="layouts/_shortcodes/card.html"} <div class="card"> {{ with .Get "title" }} <div class="card-title">{{ . }}</div> @@ -113,8 +113,8 @@ Second, because we are rendering the entire shortcode as Markdown, we must adher The difference between this and the previous example is subtle but required. Note the change in indentation, the addition of a blank line, and removal of the `RenderString` method. ```diff ---- layouts/shortcodes/a.html -+++ layouts/shortcodes/b.html +--- layouts/_shortcodes/a.html ++++ layouts/_shortcodes/b.html @@ -1,8 +1,9 @@ <div class="card"> {{ with .Get "title" }} @@ -137,7 +137,7 @@ The difference between this and the previous example is subtle but required. Not [`strings.TrimSpace`]: /functions/strings/trimspace/ [CommonMark]: https://spec.commonmark.org/current/ [details]: /methods/page/renderstring/ -[indentation]: https://spec.commonmark.org/0.30/#indented-code-blocks +[indentation]: https://spec.commonmark.org/current/#indented-code-blocks [Markdown notation]: /content-management/shortcodes/#notation -[raw HTML blocks]: https://spec.commonmark.org/0.31.2/#html-blocks +[raw HTML blocks]: https://spec.commonmark.org/current/#html-blocks [security model]: /about/security/ diff --git a/docs/content/en/methods/shortcode/InnerDeindent.md b/docs/content/en/methods/shortcode/InnerDeindent.md index 0b8c8e2d8..3d7536b6b 100644 --- a/docs/content/en/methods/shortcode/InnerDeindent.md +++ b/docs/content/en/methods/shortcode/InnerDeindent.md @@ -35,7 +35,7 @@ In the example above, notice that the content between the opening and closing sh With this shortcode, calling `Inner` instead of `InnerDeindent`: -```go-html-template {file="layouts/shortcodes/gallery.html"} +```go-html-template {file="layouts/_shortcodes/gallery.html"} <div class="gallery"> {{ .Inner | strings.TrimSpace | .Page.RenderString }} </div> @@ -66,7 +66,7 @@ Hugo renders the Markdown to: Although technically correct per the CommonMark specification, this is not what we want. If we remove the indentation using the `InnerDeindent` method: -```go-html-template {file="layouts/shortcodes/gallery.html"} +```go-html-template {file="layouts/_shortcodes/gallery.html"} <div class="gallery"> {{ .InnerDeindent | strings.TrimSpace | .Page.RenderString }} </div> @@ -94,5 +94,5 @@ Hugo renders the Markdown to: ``` [commonmark]: https://commonmark.org/ -[indentation]: https://spec.commonmark.org/0.30/#indented-code-blocks +[indentation]: https://spec.commonmark.org/current/#indented-code-blocks [`Inner`]: /methods/shortcode/inner/ diff --git a/docs/content/en/methods/shortcode/IsNamedParams.md b/docs/content/en/methods/shortcode/IsNamedParams.md index 1e0a7f00e..c95398313 100644 --- a/docs/content/en/methods/shortcode/IsNamedParams.md +++ b/docs/content/en/methods/shortcode/IsNamedParams.md @@ -13,7 +13,7 @@ To support both positional and named arguments when calling a shortcode, use the With this shortcode template: -```go-html-template {file="layouts/shortcodes/myshortcode.html"} +```go-html-template {file="layouts/_shortcodes/myshortcode.html"} {{ if .IsNamedParams }} {{ printf "%s %s." (.Get "greeting") (.Get "firstName") }} {{ else }} diff --git a/docs/content/en/methods/shortcode/Name.md b/docs/content/en/methods/shortcode/Name.md index b5f9b6c17..c42513cb2 100644 --- a/docs/content/en/methods/shortcode/Name.md +++ b/docs/content/en/methods/shortcode/Name.md @@ -11,7 +11,7 @@ params: The `Name` method is useful for error reporting. For example, if your shortcode requires a "greeting" argument: -```go-html-template {file="layouts/shortcodes/myshortcode.html"} +```go-html-template {file="layouts/_shortcodes/myshortcode.html"} {{ $greeting := "" }} {{ with .Get "greeting" }} {{ $greeting = . }} diff --git a/docs/content/en/methods/shortcode/Ordinal.md b/docs/content/en/methods/shortcode/Ordinal.md index def0c016f..4c32705c1 100644 --- a/docs/content/en/methods/shortcode/Ordinal.md +++ b/docs/content/en/methods/shortcode/Ordinal.md @@ -24,7 +24,7 @@ This method is useful for, among other things, assigning unique element IDs when This shortcode performs error checking, then renders an HTML `img` element with a unique `id` attribute: -```go-html-template {file="layouts/shortcodes/img.html"} +```go-html-template {file="layouts/_shortcodes/img.html"} {{ $src := "" }} {{ with .Get "src" }} {{ $src = . }} diff --git a/docs/content/en/methods/shortcode/Page.md b/docs/content/en/methods/shortcode/Page.md index 774caf9fc..0fa1c9cc9 100644 --- a/docs/content/en/methods/shortcode/Page.md +++ b/docs/content/en/methods/shortcode/Page.md @@ -26,7 +26,7 @@ Calling this shortcode: We can access the front matter values using the `Page` method: -```go-html-template {file="layouts/shortcodes/book-details.html"} +```go-html-template {file="layouts/_shortcodes/book-details.html"} <ul> <li>Title: {{ .Page.Title }}</li> <li>Author: {{ .Page.Params.author }}</li> diff --git a/docs/content/en/methods/shortcode/Params.md b/docs/content/en/methods/shortcode/Params.md index f001e737f..c8252f5b1 100644 --- a/docs/content/en/methods/shortcode/Params.md +++ b/docs/content/en/methods/shortcode/Params.md @@ -15,7 +15,7 @@ When you call a shortcode using positional arguments, the `Params` method return {{</* myshortcode "Hello" "world" */>}} ``` -```go-html-template {file="layouts/shortcodes/myshortcode.html"} +```go-html-template {file="layouts/_shortcodes/myshortcode.html"} {{ index .Params 0 }} → Hello {{ index .Params 1 }} → world ``` @@ -26,7 +26,7 @@ When you call a shortcode using named arguments, the `Params` method returns a m {{</* myshortcode greeting="Hello" name="world" */>}} ``` -```go-html-template {file="layouts/shortcodes/myshortcode.html"} +```go-html-template {file="layouts/_shortcodes/myshortcode.html"} {{ .Params.greeting }} → Hello {{ .Params.name }} → world ``` diff --git a/docs/content/en/methods/shortcode/Parent.md b/docs/content/en/methods/shortcode/Parent.md index 91c445d2a..4597d1034 100644 --- a/docs/content/en/methods/shortcode/Parent.md +++ b/docs/content/en/methods/shortcode/Parent.md @@ -19,13 +19,13 @@ Welcome. Today is {{</* now */>}}. {{</* /greeting */>}} ``` -```go-html-template {file="layouts/shortcodes/greeting.html"} +```go-html-template {file="layouts/_shortcodes/greeting.html"} <div class="greeting"> {{ .Inner | strings.TrimSpace | .Page.RenderString }} </div> ``` -```go-html-template {file="layouts/shortcodes/now.html"} +```go-html-template {file="layouts/_shortcodes/now.html"} {{- $dateFormat := "January 2, 2006 15:04:05" }} {{- with .Params }} diff --git a/docs/content/en/methods/shortcode/Position.md b/docs/content/en/methods/shortcode/Position.md index 24810e825..4052a735b 100644 --- a/docs/content/en/methods/shortcode/Position.md +++ b/docs/content/en/methods/shortcode/Position.md @@ -11,7 +11,7 @@ params: The `Position` method is useful for error reporting. For example, if your shortcode requires a "greeting" argument: -```go-html-template {file="layouts/shortcodes/myshortcode.html"} +```go-html-template {file="layouts/_shortcodes/myshortcode.html"} {{ $greeting := "" }} {{ with .Get "greeting" }} {{ $greeting = . }} diff --git a/docs/content/en/methods/site/Language.md b/docs/content/en/methods/site/Language.md index 31f15b8cb..73a64e4cc 100644 --- a/docs/content/en/methods/site/Language.md +++ b/docs/content/en/methods/site/Language.md @@ -72,7 +72,7 @@ Some of the methods above are commonly used in a base template as attributes for ```go-html-template <html lang="{{ .Site.Language.LanguageCode }}" - dir="{{ or .Site.Language.LanguageDirection `ltr` }} + dir="{{ or .Site.Language.LanguageDirection `ltr` }}" > ``` diff --git a/docs/content/en/methods/site/Taxonomies.md b/docs/content/en/methods/site/Taxonomies.md index 92dc41a9b..857bfd01d 100644 --- a/docs/content/en/methods/site/Taxonomies.md +++ b/docs/content/en/methods/site/Taxonomies.md @@ -140,7 +140,7 @@ The following example displays all terms in a site's tags taxonomy: ``` This example will list all taxonomies and their terms, as well as all the content assigned to each of the terms. -```go-html-template {file="layouts/partials/all-taxonomies.html"} +```go-html-template {file="layouts/_partials/all-taxonomies.html"} {{ with .Site.Taxonomies }} {{ $numberOfTerms := 0 }} {{ range $taxonomy, $terms := . }} |