hugo/content/en/functions/hugo.md
Bjørn Erik Pedersen da16527896 Squashed 'docs/' changes from 32cb8785e..4c1309cdf
4c1309cdf Fix broken link to front matter page (#1923)
8181fff20 Add footnote to Quick Start guide for Win users (#1922)
4fd934f61 Fix abslangurl.md (#1919)
bf2c45617 Quick start guide: fix broken links (#1915)
201b568df Update theme
874db199d Hide the news stripe on front page for now
aaf59e3e2 netlify: Hugo 0.107.0
79654c301 Merge branch 'tempv107'
8345e0347 docs: Regen docs helper
b5b4f15f9 Add assets directory to directory structure diagram (#1917)
76dd3a82a Follow-up: improve function signatures (#1914) (#1916)
656dc72ba Improving function signatures (#1914)
b715e8407 Explain how to create multilingual content (#1912)
8500ee417 Fix typo in Quick Start guide
ce60bb572 Add docu for undocumented functions (#1907)
372bf5e88 Improve Quick Start tutorial
71e81ec5f Remove asciicast from site
1e56c653f Update hosting-on-cloudflare-pages.md (#1903)
1686f60b1 Adding documentation page for function 'strings.FirstUpper' (#1901)
d533f7c9c Fixing typos (#1900)
2563eee45 Update multilingual.md (#1899)
2173ed799 Update theme
5591b8875 Update urls.md (#1897)
4a88890b5 netlify: Hugo 0.106.0
512879fdd docs: Regen CLI docs
f74b1d87d docs: Regenerate docs helper
9feacb48f Merge commit '00c4484c7092181729f6f470805bc7d72e8ad17b'

git-subtree-dir: docs
git-subtree-split: 4c1309cdfe9858434684352f9d544bf0c5c9d646
2022-12-02 09:19:23 +01:00

3 KiB

title linktitle description date publishdate keywords categories menu toc signature workson hugoversion relatedfuncs deprecated draft aliases
hugo hugo The `hugo` function provides easy access to Hugo-related data. 2019-01-31 2019-01-31
functions
docs
parent
functions
hugo
false false

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.Version
the current version of the Hugo binary you are using e.g. 0.99.1
hugo.GoVersion
returns the version of Go that the Hugo binary was built with. {{< new-in "0.101.0" >}}
hugo.Environment
the current running environment as defined through the --environment cli tag
hugo.CommitHash
the git commit hash of the current Hugo binary e.g. 0e8bed9ccffba0df554728b46c5bbf6d78ae5247
hugo.BuildDate
the compile date of the current Hugo binary formatted with RFC 3339 e.g. 2002-10-02T10:00:00-05:00
hugo.IsExtended
whether this is the extended Hugo binary.
hugo.IsProduction
returns true if hugo.Environment is set to the production environment

{{% note "Use the Hugo Generator Tag" %}} We highly recommend using hugo.Generator in your website's <head>. hugo.Generator is included by default in all themes hosted on themes.gohugo.io. The generator tag allows the Hugo team to track the usage and popularity of Hugo. {{% /note %}}

hugo.Deps
See hugo.Deps

hugo.Deps

{{< new-in "0.92.0" >}}

hugo.Deps returns a list of dependencies for a project (either Hugo Modules or local theme components).

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.
Replace (*Dependency)
Replaced by this dependency.

An example table listing the dependencies:

 <h2>Dependencies</h2>
<table class="table table-dark">
  <thead>
    <tr>
      <th scope="col">#</th>
      <th scope="col">Owner</th>
      <th scope="col">Path</th>
      <th scope="col">Version</th>
      <th scope="col">Time</th>
      <th scope="col">Vendor</th>
    </tr>
  </thead>
  <tbody>
    {{ range $index, $element := hugo.Deps }}
    <tr>
      <th scope="row">{{ add $index 1 }}</th>
      <td>{{ with $element.Owner }}{{.Path }}{{ end }}</td>
      <td>
        {{ $element.Path }}
        {{ with $element.Replace}}
        => {{ .Path }}
        {{ end }}
      </td>
      <td>{{ $element.Version }}</td>
      <td>{{ with $element.Time }}{{ . }}{{ end }}</td>
      <td>{{ $element.Vendor }}</td>
    </tr>
    {{ end }}
  </tbody>
</table>