Miscellaneous corrections

This commit is contained in:
Joe Mooring 2023-11-12 15:42:31 -08:00 committed by GitHub
parent 3509e1b4d4
commit 1de5a52dda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 63 additions and 17 deletions

View File

@ -152,17 +152,17 @@ Include this in your markdown:
This will display all files in the gist alphabetically by file name.
{{< gist jmooring 50a7482715eac222e230d1e64dd9a89b >}}
{{< gist jmooring 23932424365401ffa5e9d9810102a477 >}}
To display a specific file within the gist:
```text
{{</* gist user 50a7482715eac222e230d1e64dd9a89b 1-template.html */>}}
{{</* gist user 23932424365401ffa5e9d9810102a477 list.html */>}}
```
Rendered:
{{< gist jmooring 50a7482715eac222e230d1e64dd9a89b 1-template.html >}}
{{< gist jmooring 23932424365401ffa5e9d9810102a477 list.html >}}
### `highlight`

View File

@ -5,7 +5,9 @@ categories: []
keywords: []
action:
aliases: []
related: []
related:
- functions/hugo/IsDevelopment
- functions/hugo/IsProduction
returnType: string
signatures: [hugo.Environment]
---

View File

@ -5,7 +5,9 @@ categories: []
keywords: []
action:
aliases: []
related: []
related:
- functions/hugo/IsProduction
- functions/hugo/Environment
returnType: bool
signatures: [hugo.IsDevelopment]
---

View File

@ -5,7 +5,9 @@ categories: []
keywords: []
action:
aliases: []
related: []
related:
- functions/hugo/IsDevelopment
- functions/hugo/Environment
returnType: bool
signatures: [hugo.IsProduction]
---

View File

@ -13,5 +13,5 @@ action:
```go-html-template
{{ $d = time.ParseDuration "3.5h2.5m1.5s" }}
{{ $d.Nanoseconds }} → 212.525
{{ $d.Minutes }} → 212.525
```

View File

@ -46,14 +46,14 @@ Identifiers
<pre>{{ .Fragments.Identifiers | jsonify (dict "indent" " ") }}</pre>
```
Identifiers.Contains
: (`bool`) Reports whether one or more headings on the page has the given `id`, useful for validating fragments within a link [render hook].
Identifiers.Contains ID
: (`bool`) Reports whether one or more headings on the page has the given `id` attribute, useful for validating fragments within a link [render hook].
```go-html-template
{{ .Fragments.Identifiers.Contains "section-2" }} → true
```
Identifiers.Count
Identifiers.Count ID
: (`int`) The number of headings on a page with the given `id` attribute, useful for detecting duplicates.
```go-html-template

View File

@ -10,7 +10,7 @@ action:
signatures: [PAGE.Title]
---
For pages backed by a file, the `Title` method returns the `title` field in front matter. For section pages that are automatically generated, the `Title` method returns the section name.
With pages backed by a file, the `Title` method returns the `title` field as defined in front matter:
{{< code-toggle file=content/about.md fm=true >}}
title = 'About us'
@ -20,4 +20,19 @@ title = 'About us'
{{ .Title }} → About us
```
With automatic section pages, the title is capitalized by default, using the `titleCaseStyle` defined in your site configuration. To disable this behavior, set `pluralizeListTitles` to `false` in your site configuration.
With section pages not backed by a file, the `Title` method returns the section name, pluralized and converted to title case.
To disable [pluralization]:
{{< code-toggle file=hugo >}}
pluralizeListTitles = false
{{< /code-toggle >}}
To change the [title case style], specify one of `ap`, `chicago`, `go`, `firstupper`, or `none`:
{{< code-toggle file=hugo >}}
titleCaseStyle = "ap"
{{< /code-toggle >}}
[pluralization]: /functions/inflect/pluralize
[title case style]: /getting-started/configuration/#configure-title-case

View File

@ -1,6 +1,6 @@
---
title: IsNamedParams
description: Reports whether the shortcode call specifies named or positional parameters.
description: Reports whether the shortcode call uses named parameters.
categories: []
keywords: []
action:

View File

@ -0,0 +1,29 @@
---
title: Param
description: Returns the site parameter with the given key.
categories: []
keywords: []
action:
related: []
returnType: any
signatures: [SITE.Param KEY]
---
The `Param` method on a `Site` object is a convenience method to return the value of a user-defined parameter in the site configuration.
{{< code-toggle file=hugo >}}
[params]
display_toc = true
{{< /code-toggle >}}
```go-html-template
{{ .Site.Param "display_toc" }} → true
```
The above is equivalent to either of these:
```go-html-template
{{ .Site.Params.display_toc }}
{{ index .Site.Params "display_toc: }}
```

View File

@ -365,10 +365,6 @@ When the above fails, you will see an `ERROR` log similar to the below:
ERROR 2018/11/07 10:05:55 missing value for parameter name: "/Users/bep/dev/go/gohugoio/hugo/docs/content/en/variables/shortcodes.md:32:1"
```
## More shortcode examples
More shortcode examples can be found in the [shortcodes directory for spf13.com][spfscs] and the [shortcodes directory for the Hugo docs][docsshortcodes].
## Inline shortcodes
You can also implement your shortcodes inline -- e.g. where you use them in the content file. This can be useful for scripting that you only need in one place.