diff options
Diffstat (limited to 'content/en/functions')
-rw-r--r-- | content/en/functions/anchorize.md | 14 | ||||
-rw-r--r-- | content/en/functions/append.md | 5 | ||||
-rw-r--r-- | content/en/functions/apply.md | 10 | ||||
-rw-r--r-- | content/en/functions/group.md | 6 | ||||
-rw-r--r-- | content/en/functions/hugo.md | 7 | ||||
-rw-r--r-- | content/en/functions/relurl.md | 5 | ||||
-rw-r--r-- | content/en/functions/strings.Count.md | 8 |
7 files changed, 21 insertions, 34 deletions
diff --git a/content/en/functions/anchorize.md b/content/en/functions/anchorize.md index 87aea2354..b5bd22e07 100644 --- a/content/en/functions/anchorize.md +++ b/content/en/functions/anchorize.md @@ -17,11 +17,11 @@ If [Goldmark](https://gohugo.io/getting-started/configuration-markup#goldmark) i Since the `defaultMarkdownHandler` and this template function use the same sanitizing logic, you can use the latter to determine the ID of a header for linking with anchor tags. -``` -{{anchorize "This is a header"}} → "this-is-a-header" -{{anchorize "This is also a header"}} → "this-is-also-a-header" -{{anchorize "main.go"}} → "main-go" -{{anchorize "Article 123"}} → "article-123" -{{anchorize "<- Let's try this, shall we?"}} → "let-s-try-this-shall-we" -{{anchorize "Hello, 世界"}} → "hello-世界" +```go-html-template +{{ anchorize "This is a header" }} --> "this-is-a-header" +{{ anchorize "This is also a header" }} --> "this-is-also----a-header" +{{ anchorize "main.go" }} --> "maingo" +{{ anchorize "Article 123" }} --> "article-123" +{{ anchorize "<- Let's try this, shall we?" }} --> "--lets-try-this-shall-we" +{{ anchorize "Hello, 世界" }} --> "hello-世界" ``` diff --git a/content/en/functions/append.md b/content/en/functions/append.md index 732ffeadd..3e2fc13cc 100644 --- a/content/en/functions/append.md +++ b/content/en/functions/append.md @@ -25,14 +25,9 @@ An example appending single values: The same example appending a slice to a slice: - ```go-html-template {{ $s := slice "a" "b" "c" }} {{ $s = $s | append (slice "d" "e") }} ``` The `append` function works for all types, including `Pages`. - - - - diff --git a/content/en/functions/apply.md b/content/en/functions/apply.md index 3a507c7f9..7550069a5 100644 --- a/content/en/functions/apply.md +++ b/content/en/functions/apply.md @@ -64,13 +64,13 @@ If you have `post-tag-list.html` and `post-tag-link.html` as [partials][], you * Tags: {{ $len := len . }} {{ if eq $len 1 }} - {{ partial "post-tag-link" (index . 0) }} + {{ partial "post-tag-link.html" (index . 0) }} {{ else }} {{ $last := sub $len 1 }} {{ range first $last . }} - {{ partial "post-tag-link" . }}, + {{ partial "post-tag-link.html" . }}, {{ end }} - {{ partial "post-tag-link" (index . $last) }} + {{ partial "post-tag-link.html" (index . $last) }} {{ end }} </div> {{ end }} @@ -89,7 +89,7 @@ This first version of `layouts/partials/post-tag-list.html` separates all of the <div class="tags-list"> Tags: {{ $sort := sort . }} - {{ $links := apply $sort "partial" "post-tag-link" "." }} + {{ $links := apply $sort "partial" "post-tag-link.html" "." }} {{ $clean := apply $links "chomp" "." }} {{ delimit $clean ", " }} </div> @@ -102,7 +102,7 @@ Now in the completed version, you can sort the tags, convert the tags to links w {{ with .Params.tags }} <div class="tags-list"> Tags: - {{ delimit (apply (apply (sort .) "partial" "post-tag-link" ".") "chomp" ".") ", " }} + {{ delimit (apply (apply (sort .) "partial" "post-tag-link.html" ".") "chomp" ".") ", " }} </div> {{ end }} {{< /code >}} diff --git a/content/en/functions/group.md b/content/en/functions/group.md index e1a22ef5d..203498cb1 100644 --- a/content/en/functions/group.md +++ b/content/en/functions/group.md @@ -28,10 +28,4 @@ hugoversion: "0.49" {{ end }} {{< /code >}} - - The page group you get from `group` is of the same type you get from the built-in [group methods](/templates/lists#group-content) in Hugo. The above example can even be [paginated](/templates/pagination/#list-paginator-pages). - - - - diff --git a/content/en/functions/hugo.md b/content/en/functions/hugo.md index 7602a2e34..a495eae0a 100644 --- a/content/en/functions/hugo.md +++ b/content/en/functions/hugo.md @@ -4,7 +4,6 @@ linktitle: hugo description: The `hugo` function provides easy access to Hugo-related data. date: 2019-01-31 publishdate: 2019-01-31 -lastmod: 2019-01-31 keywords: [] categories: [functions] menu: @@ -60,17 +59,17 @@ hugo.Deps `hugo.Deps` returns a list of dependencies for a project (either Hugo Modules or local theme components). -Eeach dependency contains: +Each dependency contains: Path (string) : Returns the path to this module. This will either be the module path, e.g. "github.com/gohugoio/myshortcodes", or the path below your /theme folder, e.g. "mytheme". Version (string) : The module version. - + Vendor (bool) : Whether this dependency is vendored. - + Time (time.Time) : Time version was created. diff --git a/content/en/functions/relurl.md b/content/en/functions/relurl.md index 71eefb013..af98c44f4 100644 --- a/content/en/functions/relurl.md +++ b/content/en/functions/relurl.md @@ -3,7 +3,6 @@ title: relURL description: Creates a baseURL-relative URL. date: 2017-02-01 publishdate: 2017-02-01 -lastmod: 2017-02-01 categories: [functions] menu: docs: @@ -31,7 +30,7 @@ The last two examples may look strange but can be very useful. For example, the {{< code file="layouts/partials/schemaorg-metadata.html" download="schemaorg-metadata.html" >}} <script type="application/ld+json"> { - "@context" : "http://schema.org", + "@context" : "https://schema.org", "@type" : "BlogPosting", "image" : {{ apply .Params.images "absURL" "." }} } @@ -46,5 +45,5 @@ The above uses the [apply function][] and also exposes how the Go template parse [apply function]: /functions/apply/ [configuration]: /getting-started/configuration/ -[jsonld]: https://developers.google.com/search/docs/guides/intro-structured-data +[jsonld]: https://developers.google.com/search/docs/advanced/structured-data/intro-structured-data [safejs]: /functions/safejs diff --git a/content/en/functions/strings.Count.md b/content/en/functions/strings.Count.md index 40f7043b6..f666a7843 100644 --- a/content/en/functions/strings.Count.md +++ b/content/en/functions/strings.Count.md @@ -23,7 +23,7 @@ If `SUBSTR` is an empty string, this function returns 1 plus the number of Unico Example|Result :--|:-- -`{{ "aaabaab" | strings.Count "a" }}`|5 -`{{ "aaabaab" | strings.Count "aa" }}`|2 -`{{ "aaabaab" | strings.Count "aaa" }}`|1 -`{{ "aaabaab" | strings.Count "" }}`|8 +`{{ "aaabaab" \| strings.Count "a" }}`|5 +`{{ "aaabaab" \| strings.Count "aa" }}`|2 +`{{ "aaabaab" \| strings.Count "aaa" }}`|1 +`{{ "aaabaab" \| strings.Count "" }}`|8 |