mirror of
https://github.com/gohugoio/hugo.git
synced 2025-05-06 10:46:34 +03:00
Squashed 'docs/' changes from 9be494de3..ac2c4a487
ac2c4a487 Update documentation for Ugly URLs (#1082) 88bdec17a Change 072.0 to 0.72.0 in release post's description 2aa7d7818 Update rss.md (#1104) c80677aeb Update quick-start.md (#1076) d04196bbd Minor spelling and capitalization fixes 837d2feba Fixed spelling mistake 67dc78e12 Update installing.md ce280c5d6 Update relurl.md bb4d0e703 Capitalization and Redirecting URL fixes e1fecada0 Update partials.md 1d99bb182 Typos and whitespacing issues fixed b20dba125 actually fix index function link this time f47d6f1e3 Fixing typos, whitespace issues and links dc82309b9 fix link to the index function 1eab0cbea add missing word (#1130) 9c3ee62ae more fixes e9bc5880a whitespace, typos and HTTPS fixes 93b806493 Add missing word to Module section 80ced9062 Display image on page bundles page. 727029b0a Update index.md 51fc48e4d Release 0.72.0 1ff68ac3b releaser: Add release notes to /docs for release of 0.72.0 f74a25b92 common/maps: Add Scratch.Values 2fd83db96 Add redirect support to the server bdfccf9f4 Fix typo in install instructions e12737ea6 Create SUPPORT.md git-subtree-dir: docs git-subtree-split: ac2c4a4871e90ddfb180f23704ce7ec9023529ca
This commit is contained in:
parent
9e1dcefc5f
commit
efa74c5c6e
76 changed files with 170 additions and 154 deletions
|
@ -18,8 +18,7 @@ deprecated: false
|
|||
aliases: []
|
||||
---
|
||||
|
||||
|
||||
By default all matches will be included. The number of matches can be limitted with an optional third parameter.
|
||||
By default all matches will be included. The number of matches can be limited with an optional third parameter.
|
||||
|
||||
The example below returns a list of all second level headers (`<h2>`) in the content:
|
||||
|
||||
|
@ -40,7 +39,6 @@ Hugo uses Go's [Regular Expression package](https://golang.org/pkg/regexp/), whi
|
|||
If you are just learning RegEx, or at least Go's flavor, you can practice pattern matching in the browser at <https://regex101.com/>.
|
||||
{{% /note %}}
|
||||
|
||||
|
||||
[partials]: /templates/partials/
|
||||
[`plainify`]: /functions/plainify/
|
||||
[toc]: /content-management/toc/
|
||||
|
|
|
@ -20,7 +20,7 @@ aliases: []
|
|||
|
||||
Takes a string containing the name of the variable as input. Returns
|
||||
an empty string if the variable is not set, otherwise returns the
|
||||
value of the variable.
|
||||
value of the variable.
|
||||
|
||||
```
|
||||
{{ getenv "HOME" }}
|
||||
|
|
|
@ -22,5 +22,5 @@ aliases: []
|
|||
In the result `&` becomes `&` and so on. It escapes only: `<`, `>`, `&`, `'` and `"`.
|
||||
|
||||
```
|
||||
{{ htmlEscape "Hugo & Caddy > Wordpress & Apache" }} → "Hugo & Caddy > Wordpress & Apache"
|
||||
{{ htmlEscape "Hugo & Caddy > WordPress & Apache" }} → "Hugo & Caddy > WordPress & Apache"
|
||||
```
|
||||
|
|
|
@ -19,10 +19,10 @@ deprecated: false
|
|||
aliases: []
|
||||
---
|
||||
|
||||
`htmlUnescape` returns the given string with HTML escape codes un-escaped.
|
||||
`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.
|
||||
|
||||
```
|
||||
{{ htmlUnescape "Hugo & Caddy > Wordpress & Apache" }} → "Hugo & Caddy > Wordpress & Apache"
|
||||
{{ htmlUnescape "Hugo & Caddy > WordPress & Apache" }} → "Hugo & Caddy > WordPress & Apache"
|
||||
```
|
||||
|
|
|
@ -20,7 +20,7 @@ deprecated: false
|
|||
draft: false
|
||||
aliases: []
|
||||
---
|
||||
|
||||
|
||||
`hugo` returns an instance that contains the following functions:
|
||||
|
||||
hugo.Generator
|
||||
|
@ -29,7 +29,7 @@ hugo.Generator
|
|||
hugo.Version
|
||||
: the current version of the Hugo binary you are using e.g. `0.63.2`
|
||||
|
||||
|
||||
|
||||
`hugo` returns an instance that contains the following functions:
|
||||
|
||||
hugo.Environment
|
||||
|
|
|
@ -38,8 +38,6 @@ The function takes multiple indices as arguments, and this can be used to get ne
|
|||
{{ index $map "c" "e" }} => 20
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Example: Load Data from a Path Based on Front Matter Params
|
||||
|
||||
Assume you want to add a `location = ""` field to your front matter for every article written in `content/vacations/`. You want to use this field to populate information about the location at the bottom of the article in your `single.html` template. You also have a directory in `data/locations/` that looks like the following:
|
||||
|
@ -93,4 +91,3 @@ Now the call will return the specific file according to the location specified i
|
|||
{{ (index .Site.Data.locations .Params.location).pop_city }}
|
||||
=> 658390
|
||||
```
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ draft: false
|
|||
aliases: []
|
||||
---
|
||||
|
||||
|
||||
```
|
||||
{{ range last 10 .Pages }}
|
||||
{{ .Render "summary" }}
|
||||
|
|
|
@ -19,8 +19,6 @@ deprecated: false
|
|||
aliases: []
|
||||
---
|
||||
|
||||
|
||||
|
||||
```
|
||||
{{ md5 "Hello world, gophers!" }}
|
||||
<!-- returns the string "b3029f756f98f79e7f1b7f1d1f0dd53b" -->
|
||||
|
|
|
@ -14,7 +14,7 @@ keywords: [strings]
|
|||
signature: ["plainify INPUT"]
|
||||
workson: []
|
||||
hugoversion:
|
||||
relatedfuncs: [jsonify,]
|
||||
relatedfuncs: [jsonify]
|
||||
deprecated: false
|
||||
aliases: []
|
||||
---
|
||||
|
@ -25,7 +25,4 @@ aliases: []
|
|||
|
||||
See also the `.PlainWords`, `.Plain`, and `.RawContent` [page variables][pagevars].
|
||||
|
||||
|
||||
[pagevars]: /variables/page/
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: relURL
|
||||
description: Given a string, prepends the relative URL according to a page's position in the project directory structure.
|
||||
description: Creates a baseURL-relative URL.
|
||||
godocref:
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
|
|
|
@ -113,6 +113,11 @@ Removes the given key
|
|||
{{ .Scratch.Delete "greetings" }}
|
||||
```
|
||||
|
||||
#### .Values
|
||||
|
||||
`Values` returns the raw backing map. Note that you should just use this method on the locally scoped `Scratch` instances you obtain via `newScratch`, not
|
||||
`.Page.Scratch` etc., as that will lead to concurrency issues.
|
||||
|
||||
## Scope
|
||||
The scope of the backing data is global for the given `Page` or `Shortcode`, and spans partial and shortcode includes.
|
||||
|
||||
|
|
|
@ -48,4 +48,4 @@ $indexStartingAt1 := (add $index 1)
|
|||
```
|
||||
|
||||
|
||||
[GNU's seq]: http://www.gnu.org/software/coreutils/manual/html_node/seq-invocation.html#seq-invocation
|
||||
[GNU's seq]: https://www.gnu.org/software/coreutils/manual/html_node/seq-invocation.html#seq-invocation
|
||||
|
|
|
@ -22,7 +22,7 @@ toc: false
|
|||
deprecated: false
|
||||
---
|
||||
|
||||
A template file is any file living below the `layouts` directories of either the project or any of its theme components incudling partials and shortcodes.
|
||||
A template file is any file living below the `layouts` directories of either the project or any of its theme components including partials and shortcodes.
|
||||
|
||||
The function is particularly handy with dynamic path. The following example ensures the build will not break on a `.Type` missing its dedicated `header` partial.
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ aliases: []
|
|||
|
||||
## Example: Using `time` to get Month Index
|
||||
|
||||
The following example takes a UNIX timestamp---set as `utimestamp: "1489276800"` in a content's front matter---converts the timestamp (string) to an integer using the [`int` function][int], and then uses [`printf`][] to convert the `Month` property of `time` into an index.
|
||||
The following example takes a UNIX timestamp---set as `utimestamp: "1489276800"` in a content's front matter---converts the timestamp (string) to an integer using the [`int` function][int], and then uses [`printf`][] to convert the `Month` property of `time` into an index.
|
||||
|
||||
The following example may be useful when setting up [multilingual sites][multilingual]:
|
||||
|
||||
|
|
|
@ -33,6 +33,4 @@ Since both values are integers, they can be subtracted and then divided by the n
|
|||
Hugo's output is *static*. For the example above to be realistic, the site needs to be built every day.
|
||||
{{% /note %}}
|
||||
|
||||
|
||||
|
||||
[partial template]: /templates/partials/
|
||||
|
|
|
@ -21,7 +21,7 @@ aliases: []
|
|||
|
||||
|
||||
```
|
||||
{{ $url := urls.Parse "http://www.gohugo.io" }}
|
||||
{{ $url := urls.Parse "http://www.gohugo.io" }}
|
||||
```
|
||||
|
||||
and returns a [URL](https://godoc.org/net/url#URL) structure. The struct fields are accessed via the `.` notation:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue