Front matter cleanup (#2039)

This commit is contained in:
Joe Mooring
2023-04-01 08:29:16 -07:00
committed by GitHub
parent 928b945054
commit bc3ec033c8
276 changed files with 342 additions and 1748 deletions
-3
View File
@@ -5,8 +5,5 @@ categories: [functions]
tags: []
ns: ""
signature: []
hugoversion: ""
aliases: []
relatedfuncs: []
toc: false
---
+1 -6
View File
@@ -2,19 +2,14 @@
title: About Hugo
linktitle: Overview
description: Hugo's features, roadmap, license, and motivation.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: []
keywords: []
menu:
docs:
parent: "about"
parent: about
weight: 1
weight: 1
draft: false
aliases: [/about-hugo/,/docs/]
toc: false
---
Hugo is not your average static site generator.
+1 -8
View File
@@ -2,19 +2,12 @@
title: The Benefits of Static Site Generators
linktitle: The Benefits of Static
description: Improved performance, security and ease of use are just a few of the reasons static site generators are so appealing.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
keywords: [ssg,static,performance,security]
menu:
docs:
parent: "about"
parent: about
weight: 30
weight: 30
sections_weight: 30
draft: false
aliases: []
toc: false
---
The purpose of website generators is to render content into HTML files. Most are "dynamic site generators." That means the HTTP server---i.e., the program that sends files to the browser to be viewed---runs the generator to create a new HTML file every time an end user requests a page.
+1 -7
View File
@@ -1,17 +1,11 @@
---
title: Hugo Features
linktitle: Hugo Features
description: Hugo boasts blistering speed, robust content management, and a powerful templating language making it a great fit for all kinds of static websites.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
menu:
docs:
parent: "about"
parent: about
weight: 20
weight: 20
sections_weight: 20
draft: false
toc: true
---
+1 -5
View File
@@ -2,16 +2,13 @@
title: Hugo and the General Data Protection Regulation (GDPR)
linktitle: Hugo and GDPR
description: About how to configure your Hugo site to meet the new regulations.
date: 2018-05-25
layout: single
keywords: ["GDPR", "Privacy", "Data Protection"]
menu:
docs:
parent: "about"
parent: about
weight: 5
weight: 5
sections_weight: 5
draft: false
aliases: [/privacy/,/gdpr/]
toc: true
---
@@ -57,7 +54,6 @@ disable = false
privacyEnhanced = false
{{< /code-toggle >}}
## Disable All Services
An example Privacy Config that disables all the relevant services in Hugo. With this configuration, the other settings will not matter.
+1 -5
View File
@@ -2,17 +2,13 @@
title: Apache License
linktitle: License
description: Hugo v0.15 and later are released under the Apache 2.0 license.
date: 2016-02-01
publishdate: 2016-02-01
lastmod: 2016-03-02
categories: ["about hugo"]
keywords: ["License","apache"]
menu:
docs:
parent: "about"
parent: about
weight: 60
weight: 60
sections_weight: 60
aliases: [/meta/license]
toc: true
---
+1 -3
View File
@@ -1,15 +1,13 @@
---
title: Hugo's Security Model
description: A summary of Hugo's security model.
date: 2019-10-01
layout: single
keywords: ["Security", "Privacy"]
menu:
docs:
parent: "about"
parent: about
weight: 4
weight: 5
sections_weight: 5
aliases: [/security/]
toc: true
---
+1 -7
View File
@@ -1,18 +1,12 @@
---
title: What is Hugo
linktitle: What is Hugo
description: Hugo is a fast and modern static site generator written in Go, and designed to make website creation fun again.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
layout: single
menu:
docs:
parent: "about"
parent: about
weight: 10
weight: 10
sections_weight: 10
draft: false
aliases: [/overview/introduction/,/about/why-i-built-hugo/]
toc: true
---
-1
View File
@@ -8,7 +8,6 @@ menu:
weight: 10
keywords: [source, organization]
categories: [content management]
toc: false
weight: 10
aliases: [/content/,/content/organization]
---
+1 -2
View File
@@ -1,7 +1,6 @@
---
title: Archetypes
linkTitle: Archetypes
description: Archetypes are templates used when creating new content.
description: Archestypes are templates used when creating new content.
keywords: [archetypes,generators,metadata,front matter]
categories: [content management]
menu:
+14 -18
View File
@@ -63,30 +63,26 @@ Setting this to false will still publish Resources on demand (when a resource's
Any page, regardless of their build options, will always be available using the [`.GetPage`](/functions/GetPage) methods.
{{% /note %}}
------
### Illustrative use cases
#### Not publishing a page
Project needs a "Who We Are" content file for Front Matter and body to be used by the homepage but nowhere else.
```yaml
# content/who-we-are.md`
{{< code-toggle file="content/who-we-are.md" fm=true copy=false >}}
title: Who we are
_build:
list: false
render: false
```
{{< /code-toggle >}}
```go-html-template
{{/* layouts/index.html */}}
{{< code file="layouts/index.html" copy="false" >}}
<section id="who-we-are">
{{ with site.GetPage "who-we-are" }}
{{ .Content }}
{{ end }}
{{ with site.GetPage "who-we-are" }}
{{ .Content }}
{{ end }}
</section>
```
{{< /code >}}
#### Listing pages without publishing them
@@ -104,12 +100,12 @@ cascade:
list: true # default
{{< /code-toggle >}}
```go-html-template
{{/* layouts/_defaults/testimonials.html */}}
{{< code file="layouts/_defaults/testimonials.html" copy="false" >}}
<section id="testimonials">
{{ range first 5 .Pages }}
<blockquote cite="{{ .Params.cite }}">
{{ .Content }}
</blockquote>
{{ end }}
{{ range first 5 .Pages }}
<blockquote cite="{{ .Params.cite }}">
{{ .Content }}
</blockquote>
{{ end }}
</section>
{{< /code >}}
@@ -1,6 +1,5 @@
---
title: Comments
linkTitle: Comments
description: Hugo ships with an internal Disqus template, but this isn't the only commenting system that will work with your new Hugo website.
keywords: [sections,content,organization]
categories: [project organization, fundamentals]
@@ -1,6 +1,5 @@
---
title: Diagrams
LinkTitle: Diagrams
description: Use fenced code blocks and markdown render hooks to display diagrams.
categories: [content management]
keywords: [diagrams,drawing]
@@ -1,8 +1,6 @@
---
title: Front Matter
linkTitle: Front Matter
description: Hugo allows you to add front matter in yaml, toml, or json to your content files.
lastmod: 2017-02-24
categories: [content management]
keywords: ["front matter", "yaml", "toml", "json", "metadata", "archetypes"]
menu:
@@ -1,6 +1,5 @@
---
title: Image Processing
linkTitle: Image Processing
description: Resize, crop, rotate, filter, and convert images.
categories: [content management]
keywords: [resources, images]
-1
View File
@@ -1,6 +1,5 @@
---
title: Menus
linkTitle: Menus
description: Create menus by defining entries, localizing each entry, and rendering the resulting data structure.
categories: [content management]
keywords: [menus]
@@ -1,14 +1,11 @@
---
title: Page Bundles
linkTitle: Page Bundles
description: Content organization using Page Bundles
linkTitle: Page Bundles
keywords: [page, bundle, leaf, branch]
categories: [content management]
menu :
docs:
identifier: "page-bundles"
parent: "content-management"
parent: content-management
weight: 30
toc: true
weight: 30
@@ -132,9 +129,9 @@ Explanation of the above example:
A leaf bundle can be made headless by adding below in the Front Matter
(in the `index.md`):
```toml
{{< code-toggle file="content/headless/index.md" fm=true copy=false >}}
headless = true
```
{{< /code-toggle >}}
There are many use cases of such headless page bundles:
@@ -1,6 +1,5 @@
---
title: Page Resources
linkTitle: Page Resources
description: Page resources -- images, other pages, documents, etc. -- have page-relative URLs and their own metadata.
categories: [content management]
keywords: [bundle,content,resources]
+2 -4
View File
@@ -1,6 +1,5 @@
---
title: Related Content
linkTitle: Related Content
description: List related content in "See Also" sections.
categories: [content management]
keywords: [content]
@@ -67,8 +66,7 @@ We improved and simplified this feature in Hugo 0.111.0. Before this we had 3 di
Hugo can index the headings in your content and use this to find related content. You can enable this by adding a index of type `fragments` to your `related` configuration:
```toml
{{< code-toggle file="config" copy=false >}}
[related]
threshold = 20
includeNewer = true
@@ -78,7 +76,7 @@ name = "fragmentrefs"
type = "fragments"
applyFilter = false
weight = 80
```
{{< /code-toggle >}}
* The `name` maps to a optional front matter slice attribute that can be used to link from the page level down to the fragment/heading level.
* If `applyFilter`is enabled, the `.HeadingsFiltered` on each page in the result will reflect the filtered headings. This is useful if you want to show the headings in the related content listing:
@@ -2,9 +2,6 @@
title: Content Sections
linkTitle: Sections
description: Hugo generates a **section tree** that matches your content.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [content management]
keywords: [lists,sections,content types,organization]
menu:
@@ -1,6 +1,5 @@
---
title: Shortcodes
linkTitle: Shortcodes
description: Shortcodes are simple snippets inside your content files calling built-in or custom templates.
categories: [content management]
keywords: [markdown,content,shortcodes]
@@ -1,6 +1,5 @@
---
title: Syntax Highlighting
linkTitle: Syntax Highlighting
description: Hugo comes with really fast syntax highlighting from Chroma.
keywords: [highlighting,chroma,code blocks,syntax]
categories: [content management]
@@ -1,6 +1,5 @@
---
title: Taxonomies
linkTitle: Taxonomies
description: Hugo includes support for user-defined taxonomies.
keywords: [taxonomies,metadata,front matter,terms]
categories: [content management]
-1
View File
@@ -1,6 +1,5 @@
---
title: Table of Contents
linkTitle: Table of Contents
description: Hugo can automatically parse Markdown content and create a Table of Contents you can use in your templates.
categories: [content management]
keywords: [table of contents, toc]
-1
View File
@@ -1,6 +1,5 @@
---
title: Content Types
linkTitle: Content Types
description: Hugo is built around content organized in sections.
categories: [content management]
keywords: [lists, sections, content types, types, organization]
-1
View File
@@ -1,6 +1,5 @@
---
title: URL Management
linkTitle: URL Management
description: Control the structure and appearance of URLs through front matter entries and settings in your site configuration.
categories: [content management]
keywords: [aliases,redirects,permalinks,urls]
+2 -8
View File
@@ -2,20 +2,14 @@
title: Contribute to the Hugo Project
linktitle: Contribute to Hugo
description: Contribute to Hugo development and documentation.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [contribute]
keywords: []
menu:
docs:
parent: "contribute"
parent: contribute
weight: 01
weight: 01 #rem
draft: false
slug:
weight: 01
aliases: [/tutorials/how-to-contribute-to-hugo/,/community/contributing/]
toc: false
---
Hugo relies heavily on the enthusiasm and participation of the open-source community. We need your support in both its development and documentation.
+1 -5
View File
@@ -2,17 +2,13 @@
title: Contribute to Hugo Development
linktitle: Development
description: Hugo relies heavily on contributions from the open source community.
date: 2017-02-01
publishdate: 2017-02-01
categories: [contribute]
keywords: [dev,open source]
authors: [digitalcraftsman]
menu:
docs:
parent: "contribute"
parent: contribute
weight: 10
weight: 10
sections_weight: 10
toc: true
---
+2 -11
View File
@@ -2,16 +2,13 @@
title: Contribute to the Hugo Docs
linktitle: Documentation
description: Documentation is an integral part of any open source project. The Hugo docs are as much a work in progress as the source it attempts to cover.
date: 2017-02-01
publishdate: 2017-02-01
categories: [contribute]
keywords: [docs,documentation,community, contribute]
menu:
docs:
parent: "contribute"
parent: contribute
weight: 20
weight: 20
sections_weight: 20
aliases: [/contribute/docs/]
toc: true
---
@@ -72,19 +69,13 @@ Here is a review of the front matter fields automatically generated for you usin
`signature`
: this is a signature/syntax definition for calling the function (e.g., `apply SEQUENCE FUNCTION [PARAM...]`).
`workson`
: acceptable values include `lists`,`taxonomies`, `terms`, `groups`, and `files`.
`hugoversion`
: the version of Hugo that will ship with this new function.
`relatedfuncs`
: other [templating functions] you feel are related to your new function to help fellow Hugo users.
`{{.Content }}`
: an extended description of the new function; examples are not only welcomed but encouraged.
In the body of your function, expand the short description used in the front matter. Include as many examples as possible, and leverage the Hugo docs [`code` shortcode](#add-code-blocks). If you are unable to add examples but would like to solicit help from the Hugo community, add `needsexample: true` to your front matter.
In the body of your function, expand the short description used in the front matter. Include as many examples as possible, and leverage the Hugo docs [`code` shortcode](#add-code-blocks).
## Add Code Blocks
+1 -6
View File
@@ -2,19 +2,14 @@
title: Add Your Hugo Theme to the Showcase
linktitle: Themes
description: If you've built a Hugo theme and want to contribute back to the Hugo Community, share it with us.
date: 2017-02-01
publishdate: 2017-02-01
categories: [contribute]
keywords: [contribute,themes,design]
authors: [digitalcraftsman]
menu:
docs:
parent: "contribute"
parent: contribute
weight: 30
weight: 30
sections_weight: 30
aliases: [/contribute/theme/]
wip: true
toc: true
---
+1 -8
View File
@@ -2,17 +2,10 @@
title: Hugo Documentation
linktitle: Hugo
description: Hugo is the world's fastest static website engine. It's written in Go (aka Golang) and developed by bep, spf13 and friends.
date: 2017-02-01
publishdate: 2017-02-01
menu:
main:
parent: "section name"
weight: 01
weight: 01 #rem
draft: false
slug:
aliases: []
toc: false
weight: 01
layout: documentation-home
---
+1 -8
View File
@@ -1,20 +1,13 @@
---
title: .GetPage
description: "Gets a `Page` of a given `path`."
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [sections,lists,indexes]
signature: [".GetPage PATH"]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
aliases: []
---
`.GetPage` returns a page of a given `path`. Both `Site` and `Page` implements this method. The `Page` variant will, if given a relative path -- i.e. a path without a leading `/` -- try look for the page relative to the current page.
+1 -2
View File
@@ -1,11 +1,10 @@
---
title: .RenderString
description: "Renders markup to HTML."
date: 2019-12-18
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [markdown,goldmark,render]
signature: [".RenderString MARKUP"]
---
+2 -7
View File
@@ -1,16 +1,11 @@
---
title: Functions Quick Reference
linktitle: Functions Quick Reference
description: Comprehensive list of Hugo templating functions, including basic and advanced usage examples.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
keywords: []
menu:
docs:
parent: "functions"
weight: 01 #rem
draft: false
parent: functions
weight: 01
aliases: [/layout/functions/,/templates/functions]
---
+1 -8
View File
@@ -1,20 +1,13 @@
---
title: .AddDate
description: Returns the time corresponding to adding the given number of years, months, and days to the given time.Time value.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [dates,time]
signature: [".AddDate YEARS MONTHS DAYS"]
workson: [times]
hugoversion:
relatedfuncs: [now]
deprecated: false
aliases: []
---
```go-html-template
+1 -8
View File
@@ -1,20 +1,13 @@
---
title: after
description: "`after` slices an array to only the items after the <em>N</em>th item."
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [iteration]
signature: ["after INDEX COLLECTION"]
workson: []
hugoversion:
relatedfuncs: [last,first,seq]
deprecated: false
aliases: []
---
The following shows `after` being used in conjunction with the [`slice` function][slice]:
+1 -4
View File
@@ -1,15 +1,12 @@
---
title: anchorize
description: Takes a string and sanitizes it the same way as the [`defaultMarkdownHandler`](https://gohugo.io/getting-started/configuration-markup#configure-markup) does for markdown headers.
date: 2018-10-13
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [markdown,strings]
signature: ["anchorize INPUT"]
hugoversion: "0.39"
workson: []
relatedfuncs: [humanize]
---
+1 -5
View File
@@ -1,17 +1,13 @@
---
title: append
description: "`append` appends one or more values to a slice and returns the resulting slice."
date: 2018-09-14
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [collections]
signature: ["COLLECTION | append VALUE [VALUE]...", "COLLECTION | append COLLECTION"]
workson: []
hugoversion: "0.49"
relatedfuncs: [last,first,where,slice]
aliases: []
---
An example appending single values:
+26 -34
View File
@@ -1,21 +1,13 @@
---
title: apply
description: Given a map, array, or slice, `apply` returns a new slice with a function applied over it.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [advanced]
signature: ["apply COLLECTION FUNCTION [PARAM...]"]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
draft: false
aliases: []
---
{{< todo >}}
@@ -59,19 +51,19 @@ If you have `post-tag-list.html` and `post-tag-link.html` as [partials], you *co
{{< code file="layouts/partials/post-tag-list.html" copy="false" >}}
{{ with .Params.tags }}
<div class="tags-list">
Tags:
{{ $len := len . }}
{{ if eq $len 1 }}
{{ partial "post-tag-link.html" (index . 0) }}
{{ else }}
{{ $last := sub $len 1 }}
{{ range first $last . }}
{{ partial "post-tag-link.html" . }},
<div class="tags-list">
Tags:
{{ $len := len . }}
{{ if eq $len 1 }}
{{ partial "post-tag-link.html" (index . 0) }}
{{ else }}
{{ $last := sub $len 1 }}
{{ range first $last . }}
{{ partial "post-tag-link.html" . }},
{{ end }}
{{ partial "post-tag-link.html" (index . $last) }}
{{ end }}
{{ partial "post-tag-link.html" (index . $last) }}
{{ end }}
</div>
</div>
{{ end }}
{{< /code >}}
@@ -85,25 +77,25 @@ This first version of `layouts/partials/post-tag-list.html` separates all of the
```go-html-template
{{ with .Params.tags }}
<div class="tags-list">
Tags:
{{ $sort := sort . }}
{{ $links := apply $sort "partial" "post-tag-link.html" "." }}
{{ $clean := apply $links "chomp" "." }}
{{ delimit $clean ", " }}
</div>
<div class="tags-list">
Tags:
{{ $sort := sort . }}
{{ $links := apply $sort "partial" "post-tag-link.html" "." }}
{{ $clean := apply $links "chomp" "." }}
{{ delimit $clean ", " }}
</div>
{{ end }}
```
Now in the completed version, you can sort the tags, convert the tags to links with `layouts/partials/post-tag-link.html`, [chomp] off stray newlines, and join the tags together in a delimited list for presentation. Here is an even DRYer version of the preceding example:
{{< code file="layouts/partials/post-tag-list.html" download="post-tag-list.html" >}}
{{ with .Params.tags }}
<div class="tags-list">
Tags:
{{ delimit (apply (apply (sort .) "partial" "post-tag-link.html" ".") "chomp" ".") ", " }}
</div>
{{ end }}
{{ with .Params.tags }}
<div class="tags-list">
Tags:
{{ delimit (apply (apply (sort .) "partial" "post-tag-link.html" ".") "chomp" ".") ", " }}
</div>
{{ end }}
{{< /code >}}
{{% note %}}
+2 -10
View File
@@ -1,21 +1,13 @@
---
title: base64
description: "`base64Encode` and `base64Decode` let you easily decode content with a base64 encoding and vice versa through pipes."
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: []
relatedfuncs: []
signature: ["base64Decode INPUT", "base64Encode INPUT"]
workson: []
hugoversion:
deprecated: false
draft: false
aliases: []
---
An example:
@@ -32,7 +24,7 @@ An example:
You can also pass other data types as arguments to the template function which tries to convert them. The following will convert *42* from an integer to a string because both `base64Encode` and `base64Decode` always return a string.
```
```go-html-template
{{ 42 | base64Encode | base64Decode }}
=> "42" rather than 42
```
+1 -7
View File
@@ -2,21 +2,15 @@
title: chomp
toc: true
description: Removes any trailing newline characters.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [trim]
signature:
- "chomp INPUT"
- "strings.Chomp INPUT"
workson: []
hugoversion:
relatedfuncs: [truncate]
deprecated: false
---
Useful in a pipeline to remove newlines added by other processing (e.g., [`markdownify`](/functions/markdownify/)).
-1
View File
@@ -10,7 +10,6 @@ signature:
- "complement COLLECTION [COLLECTION]..."
- "collections.Complement COLLECTION [COLLECTION]..."
relatedfuncs: [intersect,symdiff,union]
aliases: []
---
To find the elements within `$c3` that do not exist in `$c1` or `$c2`:
+2 -6
View File
@@ -1,16 +1,12 @@
---
title: "cond"
date: 2017-09-08
title: cond
description: "Return one of two arguments, depending on the value of a third argument."
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
signature: ["cond CONTROL VAR1 VAR2"]
hugoversion: 0.27
relatedfuncs: [default]
toc: false
draft: false
---
`cond` returns *VAR1* if *CONTROL* is true, or *VAR2* if it is not.
+1 -7
View File
@@ -1,21 +1,15 @@
---
title: countrunes
description: Determines the number of runes in a string excluding any whitespace.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [counting, word count]
signature:
- "countrunes INPUT"
- "strings.CountRunes INPUT"
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
---
In contrast with `countwords` function, which counts every word in a string, the `countrunes` function determines the number of runes in the content and excludes any whitespace. This has specific utility if you are dealing with CJK-like languages.
+1 -7
View File
@@ -1,19 +1,13 @@
---
title: countwords
description: Counts the number of words in a string.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [counting, word count]
signature: ["countwords INPUT"]
workson: []
hugoversion:
relatedfuncs: [countrunes]
deprecated: false
---
The template function works similar to the [.WordCount page variable][pagevars].
+1 -2
View File
@@ -4,10 +4,9 @@ description: Returns the FNV (FowlerNollVo) 32 bit hash of a given string.
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [crypto hash FNV32 Fowler-Noll-Vo]
signature: ["crypto.FNV32a STRING"]
aliases: []
---
This function calculates the 32 bit [FNV1a hash](https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function#FNV-1a_hash) of a given string according to the [specification](https://datatracker.ietf.org/doc/html/draft-eastlake-fnv-12):
+1 -7
View File
@@ -1,21 +1,15 @@
---
title: time.Format
description: Converts a date/time to a localized string.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [dates,time,strings]
signature:
- "time.Format LAYOUT INPUT"
- "dateFormat LAYOUT INPUT"
workson: []
hugoversion:
relatedfuncs: [Format,now,Unix,time]
deprecated: false
---
`time.Format` (alias `dateFormat`) converts either a `time.Time` object (e.g. `.Date`) or a timestamp string `INPUT` into the format specified by the `LAYOUT` string.
+1 -9
View File
@@ -2,22 +2,14 @@
title: default
description: Allows setting a default value that can be returned if a first value is not set.
qref: "Returns a default value if a value is not set when checked."
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
keywords: [defaults]
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
toc:
signature: ["default DEFAULT INPUT"]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
draft: false
aliases: []
---
`default` checks whether a given value is set and returns a default value if it is not. *Set* in this context means different things depending on the data type:
+1 -10
View File
@@ -1,22 +1,13 @@
---
title: delimit
description: Loops through any array, slice, or map and returns a string of all the values separated by a delimiter.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [iteration]
toc: false
signature: ["delimit COLLECTION DELIMIT LAST"]
workson: [lists,taxonomies,terms]
hugoversion:
relatedfuncs: []
deprecated: false
draft: false
aliases: []
---
`delimit` called in your template takes the form of
+1 -7
View File
@@ -1,19 +1,13 @@
---
title: dict
description: Creates a dictionary from a list of key and value pairs.
date: 2017-02-01
publishdate: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [dictionary]
signature: ["dict KEY VALUE [KEY VALUE]..."]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
aliases: []
---
`dict` is especially useful for passing more than one value to a partial template.
+1 -2
View File
@@ -4,10 +4,9 @@ description: Returns a `time.Duration` structure, using the given time unit and
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [time duration]
signature: ["duration TIME_UNIT DURATION_NUMBER"]
aliases: []
---
`time.Duration` converts a given number into a [`time.Duration`](https://pkg.go.dev/time#Duration) structure so you can access its fields. E.g. you can perform [time operations](https://pkg.go.dev/time#Duration) on the returned `time.Duration` value:
+1 -9
View File
@@ -1,21 +1,13 @@
---
title: echoParam
description: Prints a parameter if it is set.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: []
signature: ["echoParam DICTIONARY KEY"]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
draft: false
aliases: []
---
+1 -7
View File
@@ -1,19 +1,13 @@
---
title: emojify
description: Runs a string through the Emoji emoticons processor.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [strings,emojis]
signature: ["emojify INPUT"]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
---
`emojify` runs a passed string through the Emoji emoticons processor.
+1 -9
View File
@@ -1,21 +1,13 @@
---
title: eq
linktitle: eq
description: Returns the boolean truth of arg1 == arg2.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [operators,logic]
signature: ["eq ARG1 ARG2"]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
aliases: []
---
+1 -7
View File
@@ -1,19 +1,13 @@
---
title: errorf and warnf
description: Log ERROR or WARNING from the templates.
date: 2017-09-30
publishdate: 2017-09-30
lastmod: 2017-09-30
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [strings, log, error]
signature: ["errorf FORMAT INPUT"]
workson: []
hugoversion:
relatedfuncs: [printf]
deprecated: false
---
`errorf` or `warnf` will evaluate a format string, then output the result to the ERROR or WARNING log (and only once per error message to avoid flooding the log).
+2 -10
View File
@@ -1,20 +1,12 @@
---
title: "fileExists"
linktitle: "fileExists"
date: 2017-08-31T22:38:22+02:00
title: fileExists
description: Checks for file or directory existence.
publishdate: 2017-08-31T22:38:22+02:00
lastmod: 2021-11-26
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
signature: ["os.FileExists PATH","fileExists PATH"]
workson: []
hugoversion:
relatedfuncs: ['os.ReadDir','os.ReadFile','os.Stat']
deprecated: false
aliases: []
---
The `os.FileExists` function attempts to resolve the path relative to the root of your project directory. If a matching file or directory is not found, it will attempt to resolve the path relative to the [`contentDir`](/getting-started/configuration#contentdir). A leading path separator (`/`) is optional.
-1
View File
@@ -10,7 +10,6 @@ signature:
- "findRE PATTERN INPUT [LIMIT]"
- "strings.FindRE PATTERN INPUT [LIMIT]"
relatedfuncs: [replaceRE]
aliases: []
---
By default, the `findRE` function finds all matches. You can limit the number of matches with an optional LIMIT parameter.
+1 -9
View File
@@ -1,21 +1,13 @@
---
title: first
linktitle: first
description: "Slices an array to only the first _N_ elements."
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [iteration]
signature: ["first LIMIT COLLECTION"]
workson: [lists,taxonomies,terms,groups]
hugoversion:
relatedfuncs: [after,last]
deprecated: false
aliases: []
---
`first` works in a similar manner to the [`limit` keyword in
+2 -10
View File
@@ -1,25 +1,17 @@
---
title: float
linktitle: float
description: Creates a `float` from the argument passed into the function.
date: 2017-09-28
publishdate: 2017-09-28
lastmod: 2017-09-28
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [strings,floats]
signature: ["float INPUT"]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
aliases: []
---
Useful for turning strings into floating point numbers.
```
```go-html-template
{{ float "1.23" }} → 1.23
```
+2 -9
View File
@@ -1,20 +1,13 @@
---
title: .Format
description: Formats built-in Hugo dates---`.Date`, `.PublishDate`, and `.Lastmod`---according to Go's layout string.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [dates,time]
signature: [".Format FORMAT"]
workson: [times]
hugoversion:
relatedfuncs: [dateFormat,now,Unix,time]
deprecated: false
aliases: []
toc: true
---
@@ -26,7 +19,7 @@ toc: true
Assuming a key-value of `date: 2017-03-03` in a content file's front matter, your can run the date through `.Format` followed by a layout string for your desired output at build time:
```
```go-html-template
{{ .PublishDate.Format "January 2, 2006" }} => March 3, 2017
```
+1 -9
View File
@@ -1,21 +1,13 @@
---
title: ge
linktitle: ge
description: Returns the boolean truth of arg1 >= arg2.
date: 2017-07-26
publishdate: 2017-07-26
lastmod: 2017-07-26
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [operators,logic]
signature: ["ge ARG1 ARG2"]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
aliases: []
---
+1 -9
View File
@@ -1,21 +1,13 @@
---
title: .Get
description: Accesses positional and ordered parameters in shortcode declaration.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [shortcodes]
signature: [".Get INDEX", ".Get KEY"]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
aliases: []
needsexample: true
---
`.Get` is specifically used when creating your own [shortcode template][sc], to access the [positional and named](/templates/shortcode-templates/#positional-vs-named-parameters) parameters passed to it. When used with a numeric INDEX, it queries positional parameters (starting with 0). With a string KEY, it queries named parameters.
+1 -9
View File
@@ -1,20 +1,13 @@
---
title: getenv
description: Returns the value of an environment variable, or an empty string if the environment variable is not set.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2021-11-26
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: []
signature: ["os.Getenv VARIABLE", "getenv VARIABLE"]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
aliases: []
---
Examples:
@@ -43,4 +36,3 @@ And then retrieve the values within a template:
```
With Hugo v0.91.0 and later, you must explicitly allow access to environment variables. For details, review [Hugo's Security Policy](/about/security-model/#security-policy). By default, environment variables beginning with `HUGO_` are allowed when using the `os.Getenv` function.
+1 -3
View File
@@ -1,14 +1,12 @@
---
title: group
description: "`group` groups a list of pages."
date: 2018-09-14
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [collections]
signature: ["PAGES | group KEY"]
hugoversion: "0.49"
---
{{< code file="layouts/partials/groups.html" >}}
+1 -9
View File
@@ -1,21 +1,13 @@
---
title: gt
linktitle: gt
description: Returns the boolean truth of arg1 > arg2.
date: 2017-07-26
publishdate: 2017-07-26
lastmod: 2017-07-26
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [operators,logic]
signature: ["gt ARG1 ARG2"]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
aliases: []
---
+1 -9
View File
@@ -1,21 +1,13 @@
---
title: hasprefix
linktitle: hasPrefix
description: Tests whether a string begins with prefix.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [strings]
signature: ["hasPrefix STRING PREFIX"]
workson: []
hugoversion:
relatedfuncs: [hasSuffix]
deprecated: false
aliases: []
---
* `{{ hasPrefix "Hugo" "Hu" }}` → true
+1 -9
View File
@@ -1,21 +1,13 @@
---
title: hasSuffix
linktitle: hasSuffix
description: Tests whether a string ends with suffix.
date: 2023-03-01
publishdate: 2023-03-01
lastmod: 2023-03-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [strings]
signature: ["hasSuffix STRING SUFFIX"]
workson: []
hugoversion:
relatedfuncs: [hasPrefix]
deprecated: false
aliases: []
---
* `{{ hasSuffix "Hugo" "go" }}` → true
+1 -10
View File
@@ -1,22 +1,13 @@
---
title: .HasMenuCurrent
description:
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [menus]
signature: ["PAGE.HasMenuCurrent MENU MENUENTRY"]
workson: [menus]
hugoversion:
relatedfuncs: ["IsMenuCurrent"]
deprecated: false
toc: false
draft: false
aliases: []
---
`.HasMenuCurrent` is a method in `Page` object returning a _boolean_ value. It
+1 -6
View File
@@ -1,18 +1,13 @@
---
title: highlight
linktitle: highlight
description: Renders code with a syntax highlighter.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2021-12-06
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [highlighting,code blocks,syntax]
signature: ["transform.Highlight INPUT LANG [OPTIONS]","highlight INPUT LANG [OPTIONS]"]
relatedfuncs: []
deprecated: false
toc: true
---
The `highlight` function uses the [Chroma] syntax highlighter, supporting over 200 languages with more than 40 available styles.
+1 -9
View File
@@ -1,21 +1,13 @@
---
title: hmac
linktitle: hmac
description: Returns a cryptographic hash that uses a key to sign a message.
date: 2020-05-29
publishdate: 2020-05-29
lastmod: 2020-05-29
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [hmac,checksum]
signature: ["crypto.HMAC HASH_TYPE KEY MESSAGE [ENCODING]","hmac HASH_TYPE KEY MESSAGE [ENCODING]" ]
workson: []
hugoversion:
relatedfuncs: [hmac]
deprecated: false
aliases: []
---
Set the `HASH_TYPE` argument to `md5`, `sha1`, `sha256`, or `sha512`.
+2 -10
View File
@@ -1,25 +1,17 @@
---
title: htmlEscape
linktitle:
description: Returns the given string with the reserved HTML codes escaped.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [strings, html]
signature: ["htmlEscape INPUT"]
workson: []
hugoversion:
relatedfuncs: [htmlUnescape]
deprecated: false
aliases: []
---
In the result `&` becomes `&amp;` and so on. It escapes only: `<`, `>`, `&`, `'` and `"`.
```
```go-html-template
{{ htmlEscape "Hugo & Caddy > WordPress & Apache" }} → "Hugo &amp; Caddy &gt; WordPress &amp; Apache"
```
+2 -10
View File
@@ -1,27 +1,19 @@
---
title: htmlUnescape
linktitle: htmlUnescape
description: Returns the given string with HTML escape codes un-escaped.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: []
signature: ["htmlUnescape INPUT"]
workson: []
hugoversion:
relatedfuncs: [htmlEscape]
deprecated: false
aliases: []
---
`htmlUnescape` returns the given string with HTML escape codes un-escaped.
Remember to pass the output of this to `safeHTML` if fully un-escaped characters are desired. Otherwise, the output will be escaped again as normal.
```
```go-html-template
{{ htmlUnescape "Hugo &amp; Caddy &gt; WordPress &amp; Apache" }} → "Hugo & Caddy > WordPress & Apache"
```
+1 -9
View File
@@ -1,22 +1,14 @@
---
title: hugo
linktitle: hugo
description: The `hugo` function provides easy access to Hugo-related data.
date: 2019-01-31
publishdate: 2019-01-31
keywords: []
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
toc:
signature: ["hugo"]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
draft: false
aliases: []
---
`hugo` returns an instance that contains the following functions:
+2 -10
View File
@@ -1,27 +1,19 @@
---
title: humanize
linktitle:
description: Returns the humanized version of an argument with the first letter capitalized.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [strings,casing]
signature: ["humanize INPUT"]
workson: []
hugoversion:
relatedfuncs: [anchorize]
deprecated: false
aliases: []
---
If the input is either an int64 value or the string representation of an integer, humanize returns the number with the proper ordinal appended.
```
```go-html-template
{{ humanize "my-first-post"}} → "My first post"
{{ humanize "myCamelPost"}} → "My camel post"
{{ humanize "52"}} → "52nd"
+1 -9
View File
@@ -1,24 +1,16 @@
---
title: i18n
linktitle: i18n
description: Translates a piece of content based on your i18n configuration files.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [internationalization,i18n,multilingual]
signature:
- "i18n KEY"
- "T KEY"
- "lang.Translate KEY"
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
aliases: []
---
This translates a piece of content based on your `i18n/en-US.toml` files. You can use the [go-i18n](https://github.com/nicksnyder/go-i18n) tools to manage your translations. The translations can exist in both the theme and at the root of your repository.
+1 -2
View File
@@ -1,12 +1,11 @@
---
title: Image Filters
description: The images namespace provides a list of filters and other image related functions.
date: 2017-02-01
categories: [functions]
aliases: [/functions/imageconfig/]
menu:
docs:
parent: "functions"
parent: functions
keywords: [images]
toc: true
---
+1 -9
View File
@@ -1,21 +1,13 @@
---
title: in
linktitle:
description: Checks if an element is in an array or slice--or a substring in a string---and returns a boolean.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [strings]
signature: ["in SET ITEM"]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
aliases: []
---
The elements supported are strings, integers and floats, although only float64 will match as expected.
+6 -14
View File
@@ -1,22 +1,14 @@
---
title: index
linktitle: index
description: Looks up the index(es) or key(s) of the data structure passed into it.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: []
signature: ["index COLLECTION INDEXES", "index COLLECTION KEYS"]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
aliases: [/functions/index/]
needsexample: true
---
The `index` functions returns the result of indexing its first argument by the following arguments. Each indexed item must be a map or a slice, e.g.:
@@ -61,7 +53,7 @@ Assume you want to add a `location = ""` field to your front matter for every ar
Here is an example:
{{< code-toggle file="data/locations/oslo" >}}
{{< code-toggle file="data/locations/oslo" copy=false >}}
website = "https://www.oslo.kommune.no"
pop_city = 658390
pop_metro = 1717900
@@ -69,10 +61,10 @@ pop_metro = 1717900
The example we will use will be an article on Oslo, whose front matter should be set to exactly the same name as the corresponding file name in `data/locations/`:
```toml
{{< code-toggle file="content/articles/oslo.md" fm=true copy=false >}}
title = "My Norwegian Vacation"
location = "oslo"
```
{{< /code-toggle >}}
The content of `oslo.toml` can be accessed from your template using the following node path: `.Site.Data.locations.oslo`. However, the specific file you need is going to change according to the front matter.
@@ -87,14 +79,14 @@ This is where the `index` function is needed. `index` takes 2 parameters in this
The variable for `.Params.location` is a string and can therefore replace `oslo` in the example above:
```
```go-html-template
{{ index .Site.Data.locations .Params.location }}
=> map[website:https://www.oslo.kommune.no pop_city:658390 pop_metro:1717900]
```
Now the call will return the specific file according to the location specified in the content's front matter, but you will likely want to write specific properties to the template. You can do this by continuing down the node path via dot notation (`.`):
```
```go-html-template
{{ (index .Site.Data.locations .Params.location).pop_city }}
=> 658390
```
+2 -10
View File
@@ -1,26 +1,18 @@
---
title: int
linktitle: int
description: Creates an `int` from the argument passed into the function.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [strings,integers]
signature: ["int INPUT"]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
aliases: []
---
Useful for turning strings into numbers.
```
```go-html-template
{{ int "123" }} → 123
```
+1 -9
View File
@@ -1,21 +1,13 @@
---
title: intersect
linktitle: intersect
description: Returns the common elements of two arrays or slices, in the same order as the first array.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [collections,intersect,union,complement,symdiff]
signature: ["intersect SET1 SET2"]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
aliases: []
---
A useful example is to use it as `AND` filters when combined with where:
+1 -10
View File
@@ -1,22 +1,13 @@
---
title: .IsMenuCurrent
description:
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [menus]
signature: ["PAGE.IsMenuCurrent MENU MENUENTRY"]
workson: [menus]
hugoversion:
relatedfuncs: ["HasMenuCurrent"]
deprecated: false
draft: false
aliases: []
needsexample: true
---
`.IsMenuCurrent` is a method in `Page` object returning a _boolean_ value. It
+1 -9
View File
@@ -1,21 +1,13 @@
---
title: isset
linktitle: isset
description: Returns true if the parameter is set.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: []
signature: ["isset COLLECTION INDEX", "isset COLLECTION KEY"]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
aliases: []
---
Takes either a slice, array, or channel and an index or a map and a key as input.
+1 -9
View File
@@ -1,21 +1,13 @@
---
title: jsonify
linktitle: jsonify
description: Encodes a given object to JSON.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2020-04-13
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [strings,json]
signature: ["jsonify INPUT", "jsonify OPTIONS INPUT"]
workson: []
hugoversion:
relatedfuncs: [plainify]
deprecated: false
aliases: []
---
Jsonify encodes a given object to JSON.
+1 -8
View File
@@ -1,20 +1,13 @@
---
title: lang.Merge
description: "Merge missing translations from other languages."
date: 2018-03-16
categories: [functions]
keywords: [multilingual]
menu:
docs:
parent: "functions"
toc: false
parent: functions
signature: ["lang.Merge FROM TO"]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
draft: false
aliases: []
comments:
---
+1 -2
View File
@@ -2,12 +2,11 @@
title: lang
package: lang
description: "TODO.."
date: 2021-07-28
categories: [functions]
keywords: [numbers]
menu:
docs:
parent: "functions"
parent: functions
signature: ["lang.NumFmt PRECISION NUMBER [OPTIONS [DELIMITER]]"]
aliases: ['/functions/numfmt/']
type: 'template-func'
+2 -11
View File
@@ -1,27 +1,18 @@
---
title: last
linktitle: last
description: "slices an array to only the last <em>N</em>th elements."
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
keywords: []
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
toc:
signature: ["last INDEX COLLECTION"]
workson: [lists, taxonomies, terms, groups]
hugoversion:
relatedfuncs: []
deprecated: false
draft: false
aliases: []
---
```go-html-template
{{ range last 10 .Pages }}
{{ .Render "summary" }}
{{ .Render "summary" }}
{{ end }}
```
+1 -9
View File
@@ -1,21 +1,13 @@
---
title: le
linktitle: le
description: Returns the boolean truth of arg1 <= arg2.
date: 2017-07-26
publishdate: 2017-07-26
lastmod: 2017-07-26
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [operators,logic]
signature: ["le ARG1 ARG2"]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
aliases: []
---
+1 -10
View File
@@ -1,22 +1,13 @@
---
title: len
linktitle: len
description: Returns the length of a variable according to its type.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-04-18
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: []
signature: ["len INPUT"]
workson: [lists,taxonomies,terms]
hugoversion:
relatedfuncs: []
deprecated: false
toc: false
aliases: []
---
`len` is a built-in function in Go that returns the length of a variable according to its type. From the Go documentation:
+1 -9
View File
@@ -1,23 +1,15 @@
---
title: lower
linktitle: lower
description: Converts all characters in the provided string to lowercase.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [strings,casing]
signature:
- "lower INPUT"
- "strings.ToLower INPUT"
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
aliases: []
---
+1 -9
View File
@@ -1,21 +1,13 @@
---
title: lt
linktitle: lt
description: Returns the boolean truth of arg1 < arg2.
date: 2017-07-26
publishdate: 2017-07-26
lastmod: 2017-07-26
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [operators,logic]
signature: ["lt ARG1 ARG2"]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
aliases: []
---
+1 -6
View File
@@ -1,18 +1,13 @@
---
title: markdownify
linktitle: markdownify
description: Renders markdown to HTML.
keywords: [markdown,content]
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
signature: ["markdownify INPUT"]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
aliases: []
---
```go-html-template
+1 -9
View File
@@ -1,22 +1,14 @@
---
title: Math
description: Hugo provides mathematical operators in templates.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2023-03-11
keywords: [math, operators]
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
toc:
signature: []
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
draft: false
aliases: []
---
| Function | Description | Example |
+1 -9
View File
@@ -1,21 +1,13 @@
---
title: md5
linktitle: md5
description: hashes the given input and returns its MD5 checksum.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: []
signature: ["md5 INPUT"]
workson: []
hugoversion:
relatedfuncs: [sha]
deprecated: false
aliases: []
---
```go-html-template
+1 -5
View File
@@ -1,17 +1,13 @@
---
title: merge
description: "Returns the result of merging two or more maps."
date: 2019-08-08
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [dictionary]
signature: ["collections.Merge MAP MAP...", "merge MAP MAP..."]
workson: []
hugoversion: "0.56.0"
relatedfuncs: [dict, append, reflect.IsMap, reflect.IsSlice]
aliases: []
---
Returns the result of merging two or more maps from left to right. If a key already exists, `merge` updates its value. If a key is absent, `merge` inserts the value under the new key.
+1 -9
View File
@@ -1,21 +1,13 @@
---
title: ne
linktitle: ne
description: Returns the boolean truth of arg1 != arg2.
date: 2017-07-26
publishdate: 2017-07-26
lastmod: 2017-07-26
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [operators,logic]
signature: ["ne ARG1 ARG2"]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
aliases: []
---
+1 -9
View File
@@ -1,21 +1,13 @@
---
title: now
linktitle: now
description: Returns the current local time
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-04-30
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [dates,time]
signature: ["now"]
workson: []
hugoversion:
relatedfuncs: [Unix,dateFormat]
deprecated: false
aliases: []
---
See [`time.Time`](https://godoc.org/time#Time).
+1 -8
View File
@@ -1,20 +1,13 @@
---
title: os.Stat
description: Returns a FileInfo structure describing a file or directory.
date: 2018-08-07
publishdate: 2018-08-07
lastmod: 2021-11-26
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [files]
signature: ["os.Stat PATH"]
workson: []
hugoversion:
relatedfuncs: ['os.FileExists','os.ReadDir','os.ReadFile']
deprecated: false
aliases: []
---
The `os.Stat` function attempts to resolve the path relative to the root of your project directory. If a matching file or directory is not found, it will attempt to resolve the path relative to the [`contentDir`](/getting-started/configuration#contentdir). A leading path separator (`/`) is optional.
+1 -2
View File
@@ -6,8 +6,7 @@ categories: [functions]
keywords: ['front matter', 'params']
menu:
docs:
parent: 'functions'
aliases: []
parent: functions
---
The `.Param` method on `.Page` looks for the given `KEY` in page parameters, and returns the corresponding value. If it cannot find the `KEY` in page parameters, it looks for the `KEY` in site parameters. If it cannot find the `KEY` in either location, the `.Param` method returns `nil`.
+2 -10
View File
@@ -1,21 +1,13 @@
---
title: partialCached
linktitle: partialCached
description: Allows for caching of partials that do not need to be re-rendered on every invocation.
date: 2017-02-01
publishdate: 2017-02-01
lastmod: 2017-02-01
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [performance]
signature: ["partialCached LAYOUT INPUT [VARIANT...]"]
workson: []
hugoversion:
relatedfuncs: []
deprecated: false
aliases: []
---
The `partialCached` template function can offer significant performance gains for complex templates that don't need to be re-rendered on every invocation.
@@ -26,7 +18,7 @@ The `partialCached` template function can offer significant performance gains fo
Here is the simplest usage:
```
```go-html-template
{{ partialCached "footer.html" . }}
```
+1 -7
View File
@@ -1,19 +1,13 @@
---
title: path.Base
description: Base returns the last element of a path.
date: 2018-11-28
publishdate: 2018-11-28
lastmod: 2018-11-28
categories: [functions]
menu:
docs:
parent: "functions"
parent: functions
keywords: [path, base]
signature: ["path.Base PATH"]
workson: []
hugoversion: "0.40"
relatedfuncs: [path.BaseName, path.Clean, path.Dir, path.Ext, path.Join, path.Split]
deprecated: false
---
`path.Base` returns the last element of `PATH`.

Some files were not shown because too many files have changed in this diff Show More