mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 15:28:54 +00:00
Update function front matter across all files
This commit is contained in:
@@ -28,9 +28,11 @@ Not running a website generator on your HTTP server has many benefits. The most
|
||||
* ["Static Site Generators", O-Reilly][]
|
||||
* [StaticGen: Top Open-Source Static Site Generators (GitHub Stars)][]
|
||||
* ["Top 10 Static Website Generators," Netlify blog][]
|
||||
* ["Hugo vs. Wordpress page load speed comparison: Hugo leaves WordPress in its dust", GettingThingsTech][hugovwordpress]
|
||||
|
||||
|
||||
["An Introduction to Static Site Generators", David Walsh]: https://davidwalsh.name/introduction-static-site-generators
|
||||
["Static Site Generators", O-Reilly]: /documents/oreilly-static-site-generators.pdf
|
||||
["Top 10 Static Website Generators," Netlify blog]: https://www.netlify.com/blog/2016/05/02/top-ten-static-website-generators/
|
||||
[hugovwordpress]: https://gettingthingstech.com/hugo-vs.-wordpress-page-load-speed-comparison-hugo-leaves-wordpress-in-its-dust/
|
||||
[StaticGen: Top Open-Source Static Site Generators (GitHub Stars)]: https://www.staticgen.com/
|
||||
|
||||
@@ -144,7 +144,7 @@ _END OF TERMS AND CONDITIONS_
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets `[]` replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same “printed page” as the copyright notice for easier identification within third-party archives.
|
||||
|
||||
{{% input "apache-notice.txt" %}}
|
||||
{{% input file="apache-notice.txt" %}}
|
||||
```
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ hugo new [content-section/file-name.md]
|
||||
|
||||
We can use this pattern to create a new `.md` file in the `posts` section of the [example site][]:
|
||||
|
||||
{{% input "archetype-example.sh" %}}
|
||||
{{% input file="archetype-example.sh" %}}
|
||||
```bash
|
||||
hugo new posts/my-first-post.md
|
||||
```
|
||||
@@ -82,7 +82,7 @@ Default archetypes are convenient if your content's front matter stays consisten
|
||||
|
||||
The [example site][] includes `tags` and `categories` as [taxonomies][]. If we assume that all content files will require these two key-values, we can create a `default.md` archetype that *extends* Hugo's base archetype. In this example, we are including "golang" and "hugo" as tags and "web development" as a category.
|
||||
|
||||
{{% input "archetypes/default.md" %}}
|
||||
{{% input file="archetypes/default.md" %}}
|
||||
```toml
|
||||
+++
|
||||
tags = ["golang", "hugo"]
|
||||
@@ -99,7 +99,7 @@ If you get an `EOF error` when using `hugo new`, add a carriage return after the
|
||||
|
||||
With an `archetypes/default.md` in place, we can use the CLI to create a new post in the `posts` content section:
|
||||
|
||||
{{% input "new-post-from-default.sh" %}}
|
||||
{{% input file="new-post-from-default.sh" %}}
|
||||
```bash
|
||||
$ hugo new posts/my-new-post.md
|
||||
```
|
||||
@@ -136,7 +136,7 @@ Suppose the example site's `posts` section requires more sophisticated front mat
|
||||
|
||||
### Creating a Custom Archetype
|
||||
|
||||
{{% input "archetypes/posts.md"%}}
|
||||
{{% input file="archetypes/posts.md"%}}
|
||||
```toml
|
||||
+++
|
||||
description = ""
|
||||
@@ -150,7 +150,7 @@ categories = ""
|
||||
|
||||
With an `archetypes/posts.md` in place, we can use the CLI to create a new posts with custom `posts` metadata in the `posts` content section:
|
||||
|
||||
{{% input "new-post-from-custom.sh" %}}
|
||||
{{% input file="new-post-from-custom.sh" %}}
|
||||
```bash
|
||||
$ hugo new posts/post-from-custom.md
|
||||
```
|
||||
|
||||
@@ -56,7 +56,7 @@ You also have the option to set the following in the front matter for a given pi
|
||||
|
||||
Users have noticed that enabling Disqus comments when running the Hugo web server on `localhost` (i.e. via `hugo server`) causes the creation of unwanted discussions on the associated Disqus account. In order to prevent this, a slightly tweaked partial template is required. So, rather than using the built-in `"_internal/disqus.html"` template referenced above, create a template in `layouts/partials` that looks like the following:
|
||||
|
||||
{{% input "layouts/partials/disqus.html" %}}
|
||||
{{% input file="layouts/partials/disqus.html" %}}
|
||||
```html
|
||||
<div id="disqus_thread"></div>
|
||||
<script type="text/javascript">
|
||||
@@ -82,7 +82,7 @@ The `if` statement skips the initialization of the Disqus comment injection when
|
||||
|
||||
You can then reference the partial template:
|
||||
|
||||
{{% input "disqus-reference.html" %}}
|
||||
{{% input file="disqus-reference.html" %}}
|
||||
```golang
|
||||
{{ partial "disqus.html" . }}
|
||||
```
|
||||
|
||||
@@ -50,7 +50,7 @@ Be careful to enter <code><!--more--></code> exactly
|
||||
|
||||
You can show content summaries with the following code. You could use the following snipper, for example, in a [section template][].
|
||||
|
||||
{{% input "page-list-with-summaries.html" %}}
|
||||
{{% input file="page-list-with-summaries.html" %}}
|
||||
```html
|
||||
{{ range first 10 .Data.Pages }}
|
||||
<article>
|
||||
|
||||
@@ -105,7 +105,7 @@ By having the same _base file name_, the content pieces are linked together as t
|
||||
|
||||
To create a list of links to translated content, use a template similar to this:
|
||||
|
||||
{{% input "layouts/partials/i18nlist.html" %}}
|
||||
{{% input file="layouts/partials/i18nlist.html" %}}
|
||||
```html
|
||||
{{ if .IsTranslated }}
|
||||
<h4>{{ i18n "translations" }}</h4>
|
||||
|
||||
@@ -79,7 +79,7 @@ The `figure` shortcode can use the following named parameters:
|
||||
|
||||
#### Example `figure` Input
|
||||
|
||||
{{% input "figure-input-example.md" %}}
|
||||
{{% input file="figure-input-example.md" %}}
|
||||
```markdown
|
||||
{{</* figure src="/media/spf13.jpg" title="Steve Francia" */>}}
|
||||
```
|
||||
@@ -128,7 +128,7 @@ This shortcode will convert the source code provided into syntax-highlighted HTM
|
||||
|
||||
#### Example `highlight` Input
|
||||
|
||||
{{% input "highlight-shortcode.md" %}}
|
||||
{{% input file="highlight-shortcode.md" %}}
|
||||
```golang
|
||||
{{</* highlight html */>}}
|
||||
<section id="main">
|
||||
@@ -216,7 +216,7 @@ To embed slides from [Speaker Deck][], click on "< /> Embed" (u
|
||||
|
||||
Extract the value from the field `data-id` and pass it to the shortcode:
|
||||
|
||||
{{% input "speakerdeck-example-input.md" %}}
|
||||
{{% input file="speakerdeck-example-input.md" %}}
|
||||
```golang
|
||||
{{</* speakerdeck 4e8126e72d853c0060001f97 */>}}
|
||||
```
|
||||
|
||||
@@ -125,7 +125,7 @@ taxonomies:
|
||||
|
||||
If you do not specify any taxonomies in your [site configuration][] file *and* your content already includes front matter with `tags:` or `categories`, Hugo will automatically create taxonomy pages. To override this behavior, set the key-value pairs for both of the default taxonomies to empty strings in your `config` file.
|
||||
|
||||
{{% input "remove-default-taxonomies-config.toml" %}}
|
||||
{{% input file="remove-default-taxonomies-config.toml" %}}
|
||||
```toml
|
||||
[taxonomies]
|
||||
tag = ""
|
||||
@@ -133,7 +133,7 @@ If you do not specify any taxonomies in your [site configuration][] file *and* y
|
||||
```
|
||||
{{% /input %}}
|
||||
|
||||
{{% input "remove-default-taxonomies-config.yml" %}}
|
||||
{{% input file="remove-default-taxonomies-config.yml" %}}
|
||||
```yaml
|
||||
taxonomies:
|
||||
tag: ""
|
||||
|
||||
@@ -77,7 +77,7 @@ hugo server
|
||||
|
||||
If everything looks fine, we are ready to commit your additions. For the sake of best practices, please make sure that your commit follows our [code contribution guideline][].
|
||||
|
||||
{{% input "commit-site.sh" %}}
|
||||
{{% input file="commit-site.sh" %}}
|
||||
```git
|
||||
git commit -m "docs: Add example.com to the showcase"
|
||||
```
|
||||
|
||||
@@ -29,13 +29,9 @@ Documentation is an integral part of any open source project. The Hugo docs were
|
||||
|
||||
**IN DEVELOPMENT**
|
||||
|
||||
### Creating Default Content
|
||||
|
||||
**IN DEVELOPMENT**
|
||||
|
||||
### Adding a New Function
|
||||
|
||||
**IN DEVELOPMENT**
|
||||
|
||||
### Adding a New Showcase
|
||||
|
||||
@@ -80,7 +76,7 @@ Use the `note` shortcode when you want to draw attention to information subtly.
|
||||
|
||||
#### `note` Admonition Shortcode Input
|
||||
|
||||
{{% input "note-with-heading.md" %}}
|
||||
{{% input file="note-with-heading.md" %}}
|
||||
```golang
|
||||
{{%/* note "Example Note Admonition" */%}}
|
||||
Here is a piece of information I would like to draw your **attention** to.
|
||||
@@ -110,7 +106,7 @@ Use the `warning` shortcode when you want to draw the user's attention to someth
|
||||
|
||||
#### `warning` Admonition Shortcode Input
|
||||
|
||||
{{% input "warning-admonition-input.md" %}}
|
||||
{{% input file="warning-admonition-input.md" %}}
|
||||
```golang
|
||||
{{%/* warning "Example Warning" */%}}
|
||||
This is a warning, which should be reserved for *important* information like breaking changes.
|
||||
@@ -134,11 +130,11 @@ This is a warning, which should be reserved for *important* information like bre
|
||||
This is a warning, which should be reserved for *important* information like breaking changes.
|
||||
{{% /warning %}}
|
||||
|
||||
## Example Site Shortcodes
|
||||
<!-- ## Example Site Shortcodes
|
||||
|
||||
### Example File Shortcode
|
||||
|
||||
### Example Front Matter Shortcode
|
||||
### Example Front Matter Shortcode -->
|
||||
|
||||
## Editorial Style Guide
|
||||
|
||||
@@ -146,7 +142,7 @@ This is a warning, which should be reserved for *important* information like bre
|
||||
It's more important to contribute *some* documentation than no documentation at all. We need your help!
|
||||
{{% /note %}}
|
||||
|
||||
The Hugo docs are not especially prescriptive in terms of grammar and usage. We encourage everyone to contribute, regardless of your writing style. That said, here are a few gotchas when writing your documentation that, if observed, will create a more consistent documentation experience:
|
||||
The Hugo docs are not especially prescriptive in terms of grammar and usage. We encourage everyone to contribute regardless of your writing style. That said, here are a few gotchas when writing your documentation that, if observed, will create a more consistent documentation experience:
|
||||
|
||||
1. *Front matter* is two words.
|
||||
2. *Homepage* is one word.
|
||||
|
||||
@@ -45,7 +45,7 @@ Highlighting is carried out via the [built-in shortcode](/content-management/sho
|
||||
|
||||
### Example `highlight` Shortcode Input
|
||||
|
||||
{{% input "example-highlight-shortcode-input.md" %}}
|
||||
{{% input file="example-highlight-shortcode-input.md" %}}
|
||||
```html
|
||||
{{</* highlight html */>}}
|
||||
<section id="main">
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -10,6 +10,5 @@ weight: 01
|
||||
draft: false
|
||||
slug:
|
||||
aliases: [/layout/functions/]
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [multilingual,i18n,urls]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [urls]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
[Link to Taxonomy templates](/templates/taxonomy-templates/)
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [dates,time]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -9,7 +9,12 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [defaults]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: [/functions/default/]
|
||||
---
|
||||
@@ -23,7 +28,7 @@ Checks whether a given value is set and returns a default value if it is not. *S
|
||||
|
||||
`default` function examples reference the following content page:
|
||||
|
||||
{{% input "content/posts/default-function-example.md" %}}
|
||||
{{% input file="content/posts/default-function-example.md" %}}
|
||||
```yaml
|
||||
---
|
||||
title: Sane Defaults
|
||||
@@ -47,7 +52,7 @@ Both of the above `default` function calls return `Roboto`.
|
||||
|
||||
A `default` value, however, does not need to be hard coded like the previous example. The `default` value can be a variable or pulled directly from the front matter using dot notation:
|
||||
|
||||
{{% input "variable-as-default-value.html" nocopy %}}
|
||||
{{% input file="variable-as-default-value.html" nocopy="true" %}}
|
||||
```golang
|
||||
{{$old := .Params.oldparam }}
|
||||
<p>{{ .Params.newparam | default $old }}</p>
|
||||
@@ -62,7 +67,7 @@ Which would return:
|
||||
|
||||
And then using dot notation
|
||||
|
||||
{{% input "dot-notation-default-value.html" %}}
|
||||
{{% input file="dot-notation-default-value.html" %}}
|
||||
```golang
|
||||
<title>{{ .Params.seo_title | default .Title }}</title>
|
||||
```
|
||||
@@ -80,7 +85,7 @@ The following have equivalent return values but are far less terse. This demonst
|
||||
|
||||
Using `if`:
|
||||
|
||||
{{% input "if-instead-of-default.html" nocopy %}}
|
||||
{{% input file="if-instead-of-default.html" nocopy="true" %}}
|
||||
```golang
|
||||
<title>{{if .Params.seo_title}}{{.Params.seo_title}}{{else}}{{.Title}}{{end}}</title>
|
||||
=> Sane Defaults
|
||||
@@ -89,7 +94,7 @@ Using `if`:
|
||||
|
||||
Using `with`:
|
||||
|
||||
{{% input "with-instead-of-default.html" nocopy %}}
|
||||
{{% input file="with-instead-of-default.html" nocopy="true" %}}
|
||||
```golang
|
||||
<title>{{with .Params.seo_title}}{{.}}{{else}}{{.Title}}{{end}}</title>
|
||||
=> Sane Defaults
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: delimit
|
||||
linktitle: delimit
|
||||
description: loops through any array, slice, or map and returns a string of all the values separated by a delimiter.
|
||||
description: "`delimit` loops through any array, slice, or map and returns a string of all the values separated by a delimiter."
|
||||
godocref:
|
||||
qref:
|
||||
qref: loops through array, slice, or map and returns string of all values separated by a delimiter.
|
||||
workson: []
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
@@ -11,19 +11,22 @@ lastmod: 2017-02-01
|
||||
categories: [functions]
|
||||
tags: [iteration]
|
||||
toc: false
|
||||
signature: ""
|
||||
workson: [lists,taxonomies,terms]
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
---
|
||||
|
||||
`delimit` loops through any array, slice, or map and returns a string of all the values separated by a delimiter. There is an optional third parameter that lets you choose a different delimiter to go between the last two values in the loop.
|
||||
`delimit` loops through any array, slice, or map and returns a string of all the values separated by a delimiter, the second argument in the function call. There is an optional third parameter that lets you choose a different delimiter to go between the last two values in the loop.
|
||||
|
||||
Maps will be sorted by keys, and only a slice of the values will be returned. This maintains a consistent output order.
|
||||
|
||||
`delimit` works on [lists][], [taxonomies][], and [terms][].
|
||||
To maintain a consistent output order, maps will be sorted by keys and only a slice of the values will be returned.
|
||||
|
||||
Examples of `delimit` use the following front matter:
|
||||
|
||||
{{% input "delimit-example-front-matter.toml" nocopy %}}
|
||||
{{% input file="delimit-example-front-matter.toml" nocopy="true" %}}
|
||||
```toml
|
||||
+++
|
||||
title: I love Delimit
|
||||
@@ -38,7 +41,7 @@ tags: [ "tag1", "tag2", "tag3" ]
|
||||
{{ delimit array/slice/map delimiter optionallastdelimiter}}
|
||||
```
|
||||
|
||||
{{% input "delimit-pages-tags.html" %}}
|
||||
{{% input file="delimit-pages-tags.html" %}}
|
||||
```html
|
||||
<p>Tags: {{ delimit .Params.tags ", " }}</p>
|
||||
```
|
||||
@@ -52,7 +55,7 @@ tags: [ "tag1", "tag2", "tag3" ]
|
||||
|
||||
Here is the same example but with the optional "last" delimiter:
|
||||
|
||||
{{% input "delimit-page-tags-final-and.html" %}}
|
||||
{{% input file="delimit-page-tags-final-and.html" %}}
|
||||
```golang
|
||||
Tags: {{ delimit .Params.tags ", " ", and " }}
|
||||
```
|
||||
|
||||
@@ -9,7 +9,12 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
---
|
||||
|
||||
@@ -8,7 +8,12 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
---
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,9 +8,13 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [functions]
|
||||
tags: [shortcodes]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,7 +8,12 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [functions]
|
||||
tags: [menus]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
---
|
||||
|
||||
@@ -8,7 +8,12 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [functions]
|
||||
tags: [menus]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
---
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [functions]
|
||||
tags: [internationalization,i18n,multilingual]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
From the godocs:
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,7 +8,12 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [functions]
|
||||
tags: [menus]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
---
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [markdown,content]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [math, operators]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
There are 6 basic mathematical operators that can be used in Hugo templates:
|
||||
|
||||
@@ -9,9 +9,13 @@ lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,9 +8,13 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [urls]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [iteration,fundamentals]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [files]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [files]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [functions]
|
||||
tags: [internationalization,multilingual,i18n,urls]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [urls]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [views]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [style,css,strings]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [strings]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [strings]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [strings]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [strings,urls]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [iteration]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: [/extras/scratch/,/doc/scratch/]
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
`Scratch` -- a "scratchpad" for your page-scoped variables. In most cases you can do well without `Scratch`, but there are some use cases that aren't solvable with Go's templates without `Scratch`'s help, due to scoping issues.
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -9,10 +9,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -9,10 +9,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [ordering]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [ordering]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -10,8 +10,12 @@ categories: [functions]
|
||||
tags: [strings]
|
||||
draft: false
|
||||
aliases: []
|
||||
toc: false
|
||||
notesforauthors:
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -10,8 +10,12 @@ categories: [functions]
|
||||
tags: [strings]
|
||||
draft: false
|
||||
aliases: []
|
||||
toc: false
|
||||
notesforauthors:
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -9,8 +9,12 @@ lastmod: 2017-02-01
|
||||
tags: [fundamentals,iteration]
|
||||
categories: [functions]
|
||||
weight:
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [dates,time]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [fundamentals,strings]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,11 +8,22 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [functions]
|
||||
tags: []
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
---
|
||||
|
||||
Truncate a text to a max length without cutting words or leaving unclosed HTML tags. Since Go templates are HTML-aware, truncate will handle normal strings vs HTML strings intelligently. It's important to note that if you have a raw string that contains HTML tags that you want treated as HTML, you will need to convert the string to HTML using the safeHTML template function before sending the value to truncate; otherwise, the HTML tags will be escaped by truncate.
|
||||
Truncate a text to a max length without cutting words or leaving unclosed HTML tags. Since Go templates are HTML-aware, `truncate` will intelligently handle normal strings vs HTML strings ((**INSERT EXAMPLE**)).
|
||||
|
||||
{{% note %}}
|
||||
If you have a raw string that contains HTML tags you want to remain treated as HTML, you will need to convert the string to HTML using the [`safeHTML` template function](/functions/safehtml) before sending the value to truncate. Otherwise, the HTML tags will be escaped when passed through the `truncate` function.
|
||||
{{% /note %}}
|
||||
|
||||
## Examples of `truncate`
|
||||
|
||||
`{{ "<em>Keep my HTML</em>" | safeHTML | truncate 10 }}` → `<em>Keep my …</em>`
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [dates,time]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [strings,urls]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,10 +8,14 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
@@ -8,12 +8,12 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [fundamentals]
|
||||
categories: [functions]
|
||||
toc: false
|
||||
toc:
|
||||
signature:
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: []
|
||||
deprecated: false
|
||||
draft: false
|
||||
aliases: []
|
||||
notesforauthors:
|
||||
---
|
||||
|
||||
## Example
|
||||
|
||||
## Advanced Example
|
||||
---
|
||||
@@ -234,7 +234,7 @@ No other web server software (e.g., Apache, nginx, IIS) is necessary.
|
||||
|
||||
Here is the command:
|
||||
|
||||
{{% input "hugo-production-server.sh" %}}
|
||||
{{% input file="hugo-production-server.sh" %}}
|
||||
```bash
|
||||
hugo server --baseURL=http://yoursite.org/ \
|
||||
--port=80 \
|
||||
|
||||
@@ -28,7 +28,7 @@ In this `config` file, you can direct to Hugo as to how it should render your we
|
||||
|
||||
The following is a typical example of a YAML configuration file. Note the document opens with 3 hyphens and closes with 3 periods. The values nested under `params:` will populate the [`.Site.Params`][] variable for use in [templates][]:
|
||||
|
||||
{{% input "config.yml" %}}
|
||||
{{% input file="config.yml" %}}
|
||||
```yaml
|
||||
---
|
||||
baseURL: "https://yoursite.example.com/"
|
||||
@@ -52,7 +52,7 @@ params:
|
||||
|
||||
The following is the full list of Hugo-defined variables in an example YAML file. The values provided in this example represent the default values used by Hugo.
|
||||
|
||||
{{% input "config.yml" %}}
|
||||
{{% input file="config.yml" %}}
|
||||
```yaml
|
||||
---
|
||||
archetypeDir: "archetypes"
|
||||
@@ -191,7 +191,7 @@ title = "My Hugo Site"
|
||||
|
||||
The following is the full list of Hugo-defined variables in an example TOML file. The values provided in this example represent the default values used by Hugo.
|
||||
|
||||
{{% input "config.toml" %}}
|
||||
{{% input file="config.toml" %}}
|
||||
```toml
|
||||
+++
|
||||
archetypeDir = "archetypes"
|
||||
@@ -346,7 +346,7 @@ However, if you have specific needs with respect to Markdown, Hugo exposes some
|
||||
2. Blackfriday flags must be grouped under the `blackfriday` key and can be set on both the site level *and* the page level. Any setting on a page will override the site setting there. See [site configuration for more information](/content-management/front-matter/#override-global-blackfriday-configuration).
|
||||
{{% /note %}}
|
||||
|
||||
{{% input "bf-config.toml" %}}
|
||||
{{% input file="bf-config.toml" %}}
|
||||
```toml
|
||||
[blackfriday]
|
||||
angledQuotes = true
|
||||
@@ -356,7 +356,7 @@ However, if you have specific needs with respect to Markdown, Hugo exposes some
|
||||
```
|
||||
{{% /input %}}
|
||||
|
||||
{{% input "bf-config.yml" %}}
|
||||
{{% input file="bf-config.yml" %}}
|
||||
```yaml
|
||||
blackfriday:
|
||||
angledQuotes: true
|
||||
|
||||
@@ -39,7 +39,7 @@ Ideally, you should install it somewhere in your `PATH` for easy use. `/usr/loca
|
||||
|
||||
If you are on OS X and using [Homebrew][brew], you can install Hugo with the following one-liner:
|
||||
|
||||
{{% input "install-with-homebrew.sh" %}}
|
||||
{{% input file="install-with-homebrew.sh" %}}
|
||||
```bash
|
||||
brew update && brew install hugo
|
||||
```
|
||||
@@ -110,7 +110,7 @@ Since building from source is appealing to more seasoned command line users, thi
|
||||
|
||||
Go to the `brew` website, <http://brew.sh/>, and follow the directions there. The most important step is the installation from the command line:
|
||||
|
||||
{{% input "install-brew.sh" %}}
|
||||
{{% input file="install-brew.sh" %}}
|
||||
```bash
|
||||
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||
```
|
||||
@@ -120,7 +120,7 @@ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/
|
||||
|
||||
Whenever installing with Homebrew, it's a good idea to update the formulae and Homebrew itself by running the update command:
|
||||
|
||||
{{% input "update-brew.sh" %}}
|
||||
{{% input file="update-brew.sh" %}}
|
||||
```bash
|
||||
$ brew update
|
||||
```
|
||||
@@ -128,7 +128,7 @@ $ brew update
|
||||
|
||||
You can then install Hugo using `brew`:
|
||||
|
||||
{{% input "install-brew.sh" %}}
|
||||
{{% input file="install-brew.sh" %}}
|
||||
```bash
|
||||
$ brew install hugo
|
||||
```
|
||||
|
||||
@@ -91,7 +91,7 @@ You'll see the `bookshelf` directory has 6 subdirectories and 1 file. Let's look
|
||||
|
||||
Let's now add a post to our "bookshelf." We will use the `hugo new` command to add a post. This first post will be on the book [*Good To Great*][bookurl]. Make sure you are inside the `bookshelf` directory.
|
||||
|
||||
{{% input "create-new-book-review-post.sh" %}}
|
||||
{{% input file="create-new-book-review-post.sh" %}}
|
||||
```bash
|
||||
hugo new post/good-to-great.md
|
||||
```
|
||||
@@ -137,7 +137,7 @@ The text bracketed by `+++` is the TOML [front matter][frontmatter] for the cont
|
||||
|
||||
Let's update `good-to-great.md` with a short review of *Good to Great*:
|
||||
|
||||
{{% input "good-to-great-start.md" %}}
|
||||
{{% input file="good-to-great-start.md" %}}
|
||||
```markdown
|
||||
+++
|
||||
date = "2016-02-14T16:11:58+05:30"
|
||||
@@ -230,7 +230,7 @@ You can clone one or more themes from within the `themes` directory. We will use
|
||||
|
||||
Once inside the `themes` directory, you can use the following one-liner to clone Robust, check out the specific commit, and then return to your project's root directory:
|
||||
|
||||
{{% input "clone-robust-theme" %}}
|
||||
{{% input file="clone-robust-theme" %}}
|
||||
```bash
|
||||
git clone https://github.com/dim0627/hugo_theme_robust.git && cd hugo_theme_robust && git checkout 3baae29 && cd ../..
|
||||
```
|
||||
@@ -238,7 +238,7 @@ git clone https://github.com/dim0627/hugo_theme_robust.git && cd hugo_theme_robu
|
||||
|
||||
Now let's start Hugo's server again but with the addition of the `-theme` flag for Robust:
|
||||
|
||||
{{% input "hugo-server-with-theme.sh" %}}
|
||||
{{% input file="hugo-server-with-theme.sh" %}}
|
||||
```bash
|
||||
hugo server --theme=hugo_theme_robust --buildDrafts
|
||||
```
|
||||
@@ -306,7 +306,7 @@ You can very easily switch between different themes in Hugo. Let's suppose we wa
|
||||
|
||||
From your project root, you can use this one-liner to change into `themes`, clone Bleak, and go back to your project's root directory:
|
||||
|
||||
{{% input "clone-bleak-theme.sh" %}}
|
||||
{{% input file="clone-bleak-theme.sh" %}}
|
||||
```bash
|
||||
cd themes && git clone https://github.com/Zenithar/hugo-theme-bleak.git && cd ..
|
||||
```
|
||||
@@ -314,7 +314,7 @@ cd themes && git clone https://github.com/Zenithar/hugo-theme-bleak.git && cd ..
|
||||
|
||||
Now restart the server with our new theme flag:
|
||||
|
||||
{{% input "run-server-with-bleak.sh" %}}
|
||||
{{% input file="run-server-with-bleak.sh" %}}
|
||||
```bash
|
||||
hugo server --theme=hugo-theme-bleak --buildDrafts
|
||||
```
|
||||
@@ -328,7 +328,7 @@ Our website is now using the `bleak` theme at <http://localhost:1313>, which sho
|
||||
|
||||
Kill the Hugo server if you are still running it with the Bleak theme, and then restart the server with the `robust` theme. We will use Robust for the duration of this Quick Start:
|
||||
|
||||
{{% input "restart-with-robust-sh" %}}
|
||||
{{% input file="restart-with-robust-sh" %}}
|
||||
```bash
|
||||
hugo server --theme=hugo_theme_robust --buildDrafts
|
||||
```
|
||||
@@ -338,7 +338,7 @@ hugo server --theme=hugo_theme_robust --buildDrafts
|
||||
|
||||
Our website is currently using the dummy values specified in `bookshelf/config.toml`, which were auto-generated with `hugo new site bookshelf`. Let's update the configuration:
|
||||
|
||||
{{% input "updated-config.toml" %}}
|
||||
{{% input file="updated-config.toml" %}}
|
||||
```toml
|
||||
baseURL = "http://example.org/"
|
||||
languageCode = "en-us"
|
||||
@@ -404,7 +404,7 @@ Now we need to change the layout of the index page so that only images are shown
|
||||
|
||||
Create a new file for `li.html` inside the `bookshelf/layouts/_default` directory. If you are in your project root, you can use the following one-liner to both create the file and return to the project root:
|
||||
|
||||
{{% input "create-new-li-html.sh" %}}
|
||||
{{% input file="create-new-li-html.sh" %}}
|
||||
```bash
|
||||
cd layouts && mkdir _default && cd _default && touch li.html && cd ../..
|
||||
```
|
||||
@@ -412,7 +412,7 @@ cd layouts && mkdir _default && cd _default && touch li.html && cd ../..
|
||||
|
||||
Copy the content shown below into the new `li.html`. When contrasting this with the `li.html` that ships with the Robust theme, you'll notice we have removed details of the book so that only the image is shown:
|
||||
|
||||
{{% input "layouts/_default/li.html" %}}
|
||||
{{% input file="layouts/_default/li.html" %}}
|
||||
```html
|
||||
<article class="li">
|
||||
<a href="{{ .Permalink }}" class="clearfix">
|
||||
@@ -430,7 +430,7 @@ Next, we want to remove information related to the theme from the footer. Let's
|
||||
|
||||
This is a new [partial template][partialtemplates]. If you are still in the project's root directory, you can use the following one-liner to create the partial before returning to the project root:
|
||||
|
||||
{{% input "create-new-default-foot.sh" %}}
|
||||
{{% input file="create-new-default-foot.sh" %}}
|
||||
```bash
|
||||
cd layouts && mkdir partials && cd partials && touch default_foot.html && cd ../..
|
||||
```
|
||||
@@ -438,7 +438,7 @@ cd layouts && mkdir partials && cd partials && touch default_foot.html && cd ../
|
||||
|
||||
Now add the following to our new `default_foot.html` partial template:
|
||||
|
||||
{{% input "layouts/partials/default_foot.html" %}}
|
||||
{{% input file="layouts/partials/default_foot.html" %}}
|
||||
```html
|
||||
<footer class="site">
|
||||
<p>{{ with .Site.Copyright | safeHTML }}{{ . }}{{ else }}© {{ $.Site.LastChange.Year }} {{ if isset $.Site.Params "Author" }}{{ $.Site.Params.Author }}{{ else }}{{ .Site.Title }}{{ end }}{{ end }}</p>
|
||||
@@ -449,7 +449,7 @@ Now add the following to our new `default_foot.html` partial template:
|
||||
|
||||
So far we are using the default image, but we would like to use the book image so that we can relate to the book. Every book review will define a configuration setting in its front matter. Update the content and front matter of `good-to-great.md` as shown below.
|
||||
|
||||
{{% input "content/post/good-to-great.md" %}}
|
||||
{{% input file="content/post/good-to-great.md" %}}
|
||||
```markdown
|
||||
+++
|
||||
date = "2017-02-19T21:09:05-06:00"
|
||||
@@ -547,7 +547,7 @@ There is more than one way to host your site on GitHub. Be sure to check out [Ho
|
||||
|
||||
First, let's set up Git version control for your bookshelf website and include a `.gitignore` file to prevent tracking of the `public` and `themes` directories. From within your root project directory, you can use the following one-liner:
|
||||
|
||||
{{% input "set-up-git.sh" %}}
|
||||
{{% input file="set-up-git.sh" %}}
|
||||
```bash
|
||||
git init && echo "/public/" >> .gitignore && echo "/themes/" >> .gitignore && git add . && git commit -m "Initial commit"
|
||||
```
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user