Skip to content

Commit

Permalink
Miscellaneous corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
jmooring committed Nov 12, 2023
1 parent 3509e1b commit c879e7f
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 17 deletions.
6 changes: 3 additions & 3 deletions content/en/content-management/shortcodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
4 changes: 3 additions & 1 deletion content/en/functions/hugo/Environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ categories: []
keywords: []
action:
aliases: []
related: []
related:
- functions/hugo/IsDevelopment
- functions/hugo/IsProduction
returnType: string
signatures: [hugo.Environment]
---
Expand Down
4 changes: 3 additions & 1 deletion content/en/functions/hugo/IsDevelopment.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ categories: []
keywords: []
action:
aliases: []
related: []
related:
- functions/hugo/IsProduction
- functions/hugo/Environment
returnType: bool
signatures: [hugo.IsDevelopment]
---
Expand Down
4 changes: 3 additions & 1 deletion content/en/functions/hugo/IsProduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ categories: []
keywords: []
action:
aliases: []
related: []
related:
- functions/hugo/IsDevelopment
- functions/hugo/Environment
returnType: bool
signatures: [hugo.IsProduction]
---
Expand Down
2 changes: 1 addition & 1 deletion content/en/methods/duration/Minutes.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ action:

```go-html-template
{{ $d = time.ParseDuration "3.5h2.5m1.5s" }}
{{ $d.Nanoseconds }} → 212.525
{{ $d.Minutes }} → 212.525
```
6 changes: 3 additions & 3 deletions content/en/methods/page/Fragments.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 17 additions & 2 deletions content/en/methods/page/Title.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
2 changes: 1 addition & 1 deletion content/en/methods/shortcode/IsNamedParams.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
29 changes: 29 additions & 0 deletions content/en/methods/site/Param.md
Original file line number Diff line number Diff line change
@@ -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: }}
```
4 changes: 0 additions & 4 deletions content/en/templates/shortcode-templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit c879e7f

Please sign in to comment.