mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-28 06:30:33 +03:00
Merge commit 'd3927310d5
'
This commit is contained in:
commit
a838a27e4c
75 changed files with 214 additions and 167 deletions
|
@ -13,32 +13,35 @@ relatedfuncs: []
|
|||
|
||||
`hugo` returns an instance that contains the following functions:
|
||||
|
||||
hugo.Generator
|
||||
: `<meta>` tag for the version of Hugo that generated the site. `hugo.Generator` outputs a *complete* HTML tag; e.g. `<meta name="generator" content="Hugo 0.63.2">`
|
||||
`hugo.BuildDate`
|
||||
: (`string`) The compile date of the current Hugo binary formatted per [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339) (e.g., `2023-05-23T08:14:20Z`).
|
||||
|
||||
hugo.Version
|
||||
: the current version of the Hugo binary you are using e.g. `0.99.1`
|
||||
`hugo.CommitHash`
|
||||
: (`string`) The Git commit hash of the Hugo binary (e.g., `0a95d6704a8ac8d41cc5ca8fffaad8c5c7a3754a`).
|
||||
|
||||
hugo.GoVersion
|
||||
: returns the version of Go that the Hugo binary was built with. {{< new-in "0.101.0" >}}
|
||||
`hugo.Deps`
|
||||
: (`[]*hugo.Dependency`) See [hugo.Deps](#hugodeps).
|
||||
|
||||
hugo.Environment
|
||||
: the current running environment as defined through the `--environment` cli tag
|
||||
`hugo.Environment`
|
||||
: (`string`) The current running environment as defined through the `--environment` CLI flag (e.g., `development`, `production`).
|
||||
|
||||
hugo.CommitHash
|
||||
: the git commit hash of the current Hugo binary e.g. `0e8bed9ccffba0df554728b46c5bbf6d78ae5247`
|
||||
`hugo.Generator`
|
||||
: (`template.HTML`) Renders an HTML `meta` element identifying the software that generated the site (e.g., `<meta name="generator" content="Hugo 0.112.0">`).
|
||||
|
||||
hugo.BuildDate
|
||||
: the compile date of the current Hugo binary formatted with RFC 3339 e.g. `2002-10-02T10:00:00-05:00`
|
||||
`hugo.GoVersion`
|
||||
: (`string`) The Go version used to compile the Hugo binary (e.g., `go1.20.4`). {{< new-in "0.101.0" >}}
|
||||
|
||||
hugo.IsExtended
|
||||
: whether this is the extended Hugo binary.
|
||||
`hugo.IsExtended`
|
||||
: (`bool`) Returns `true` if the Hugo binary is the extended version.
|
||||
|
||||
hugo.IsProduction
|
||||
: returns true if `hugo.Environment` is set to the production environment
|
||||
`hugo.IsProduction`
|
||||
: (`bool`) Returns `true` if `hugo.Environment` is set to the production environment.
|
||||
|
||||
hugo.Deps
|
||||
: See [hugo.Deps](#hugodeps)
|
||||
`hugo.Version`
|
||||
: (`hugo.VersionString`) The current version of the Hugo binary (e.g., `0.112.1`).
|
||||
|
||||
`hugo.WorkingDir`
|
||||
: (`string`) The project working directory (e.g., `/home/user/projects/my-hugo-site`). {{< new-in "0.112.0" >}}
|
||||
|
||||
## hugo.Deps
|
||||
|
||||
|
@ -48,28 +51,28 @@ hugo.Deps
|
|||
|
||||
Each dependency contains:
|
||||
|
||||
Path (string)
|
||||
: Returns the path to this module. This will either be the module path, e.g. "github.com/gohugoio/myshortcodes", or the path below your /theme folder, e.g. "mytheme".
|
||||
|
||||
Version (string)
|
||||
: The module version.
|
||||
|
||||
Vendor (bool)
|
||||
: Whether this dependency is vendored.
|
||||
|
||||
Time (time.Time)
|
||||
: Time version was created.
|
||||
|
||||
Owner
|
||||
: In the dependency tree, this is the first module that defines this module as a dependency.
|
||||
: (`*hugo.Dependency`) In the dependency tree, this is the first module that defines this module as a dependency (e.g., `github.com/gohugoio/hugo-mod-bootstrap-scss/v5`).
|
||||
|
||||
Replace (*Dependency)
|
||||
: Replaced by this dependency.
|
||||
Path
|
||||
: (`string`) The module path or the path below your `themes` directory (e.g., `github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2`).
|
||||
|
||||
Replace
|
||||
: (`*hugo.Dependency`) Replaced by this dependency.
|
||||
|
||||
Time
|
||||
: (`time.Time`) The time that the version was created (e.g., `2022-02-13 15:11:28 +0000 UTC`).
|
||||
|
||||
Vendor
|
||||
: (`bool`) Returns `true` if the dependency is vendored.
|
||||
|
||||
Version
|
||||
: (`string`) The module version (e.g., `v2.21100.20000`).
|
||||
|
||||
An example table listing the dependencies:
|
||||
|
||||
```html
|
||||
<h2>Dependencies</h2>
|
||||
<h2>Dependencies</h2>
|
||||
<table class="table table-dark">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
|
@ -17,7 +17,7 @@ For example, to show a table of contents on every page, but allow authors to hid
|
|||
|
||||
**Configuration**
|
||||
|
||||
{{< code-toggle file="config" copy=false >}}
|
||||
{{< code-toggle file="hugo" copy=false >}}
|
||||
[params]
|
||||
display_toc = true
|
||||
{{< /code-toggle >}}
|
||||
|
|
|
@ -12,9 +12,9 @@ relatedfuncs: []
|
|||
|
||||
It should not be used for HTML from a third-party, or HTML with unclosed tags or comments.
|
||||
|
||||
Given a site-wide [`config.toml`][config] with the following `copyright` value:
|
||||
Given a site-wide [`hugo.toml`][config] with the following `copyright` value:
|
||||
|
||||
{{< code-toggle file="config" >}}
|
||||
{{< code-toggle file="hugo" >}}
|
||||
copyright = "© 2015 Jane Doe. <a href=\"https://creativecommons.org/licenses/by/4.0/\">Some rights reserved</a>."
|
||||
{{< /code-toggle >}}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ relatedfuncs: []
|
|||
|
||||
Given a site configuration that contains this menu entry:
|
||||
|
||||
{{< code-toggle file="config" >}}
|
||||
{{< code-toggle file="hugo" >}}
|
||||
[[menu.main]]
|
||||
name = "IRC"
|
||||
url = "irc://irc.freenode.net/#golang"
|
||||
|
|
|
@ -14,9 +14,9 @@ relatedfuncs: []
|
|||
|
||||
Without `safeURL`, only the URI schemes `http:`, `https:` and `mailto:` are considered safe by Go templates. If any other URI schemes (e.g., `irc:` and `javascript:`) are detected, the whole URL will be replaced with `#ZgotmplZ`. This is to "defang" any potential attack in the URL by rendering it useless.
|
||||
|
||||
The following examples use a [site `config.toml`][configuration] with the following [menu entry][menus]:
|
||||
The following examples use a [site `hugo.toml`][configuration] with the following [menu entry][menus]:
|
||||
|
||||
{{< code-toggle file="config" copy=false >}}
|
||||
{{< code-toggle file="hugo" copy=false >}}
|
||||
[[menu.main]]
|
||||
name = "IRC: #golang at freenode"
|
||||
url = "irc://irc.freenode.net/#golang"
|
||||
|
|
|
@ -18,7 +18,7 @@ The `ORDER` may be either `asc` (ascending) or `desc` (descending). The default
|
|||
|
||||
The examples below assume this site configuration:
|
||||
|
||||
{{< code-toggle file="config" copy=false >}}
|
||||
{{< code-toggle file="hugo" copy=false >}}
|
||||
[params]
|
||||
grades = ['b','a','c']
|
||||
{{< /code-toggle >}}
|
||||
|
@ -48,7 +48,7 @@ In the example above, `value` is the `KEY` representing the value of the slice e
|
|||
|
||||
The examples below assume this site configuration:
|
||||
|
||||
{{< code-toggle file="config" copy=false >}}
|
||||
{{< code-toggle file="hugo" copy=false >}}
|
||||
[params.authors.a]
|
||||
firstName = "Marius"
|
||||
lastName = "Pontmercy"
|
||||
|
|
|
@ -158,7 +158,7 @@ will default to the *section with the most pages*.
|
|||
|
||||
The user can override the default:
|
||||
|
||||
{{< code-toggle file="config" >}}
|
||||
{{< code-toggle file="hugo" >}}
|
||||
[params]
|
||||
mainSections = ["blog", "docs"]
|
||||
{{< /code-toggle >}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue