hugo

Fork of github.com/gohugoio/hugo with reverse pagination support

git clone git://git.shimmy1996.com/hugo.git

hugo.md (3118B)

    1 ---
    2 title: hugo
    3 linktitle: hugo
    4 description: The `hugo` function provides easy access to Hugo-related data.
    5 date: 2019-01-31
    6 publishdate: 2019-01-31
    7 keywords: []
    8 categories: [functions]
    9 menu:
   10   docs:
   11     parent: "functions"
   12 toc:
   13 signature: ["hugo"]
   14 workson: []
   15 hugoversion:
   16 relatedfuncs: []
   17 deprecated: false
   18 draft: false
   19 aliases: []
   20 ---
   21 
   22 `hugo` returns an instance that contains the following functions:
   23 
   24 hugo.Generator
   25 : `<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" />`
   26 
   27 hugo.Version
   28 : the current version of the Hugo binary you are using e.g. `0.63.2`
   29 
   30 hugo.GoVersion
   31 : returns the version of Go that the Hugo binary was built with. {{< new-in "0.101.0" >}}
   32 
   33 hugo.Environment
   34 : the current running environment as defined through the `--environment` cli tag
   35 
   36 hugo.CommitHash
   37 : the git commit hash of the current Hugo binary e.g. `0e8bed9ccffba0df554728b46c5bbf6d78ae5247`
   38 
   39 hugo.BuildDate
   40 : the compile date of the current Hugo binary formatted with RFC 3339 e.g. `2002-10-02T10:00:00-05:00`
   41 
   42 hugo.IsExtended {{< new-in "0.83.0" >}}
   43 : whether this is the extended Hugo binary.
   44 
   45 hugo.IsProduction
   46 : returns true if `hugo.Environment` is set to the production environment
   47 
   48 {{% note "Use the Hugo Generator Tag" %}}
   49 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](https://themes.gohugo.io). The generator tag allows the Hugo team to track the usage and popularity of Hugo.
   50 {{% /note %}}
   51 
   52 hugo.Deps
   53 : See [hugo.Deps](#hugodeps)
   54 
   55 ## hugo.Deps
   56 
   57 {{< new-in "0.92.0" >}}
   58 
   59 `hugo.Deps` returns a list of dependencies for a project (either Hugo Modules or local theme components).
   60 
   61 Each dependency contains:
   62 
   63 Path (string)
   64 : 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".
   65 
   66 Version (string)
   67 :  The module version.
   68 
   69 Vendor (bool)
   70 : Whether this dependency is vendored.
   71 
   72 Time (time.Time)
   73 : Time version was created.
   74 
   75 Owner
   76 : In the dependency tree, this is the first module that defines this module as a dependency.
   77 
   78 Replace (*Dependency)
   79 : Replaced by this dependency.
   80 
   81 An example table listing the dependencies:
   82 
   83 ```html
   84  <h2>Dependencies</h2>
   85 <table class="table table-dark">
   86   <thead>
   87     <tr>
   88       <th scope="col">#</th>
   89       <th scope="col">Owner</th>
   90       <th scope="col">Path</th>
   91       <th scope="col">Version</th>
   92       <th scope="col">Time</th>
   93       <th scope="col">Vendor</th>
   94     </tr>
   95   </thead>
   96   <tbody>
   97     {{ range $index, $element := hugo.Deps }}
   98     <tr>
   99       <th scope="row">{{ add $index 1 }}</th>
  100       <td>{{ with $element.Owner }}{{.Path }}{{ end }}</td>
  101       <td>
  102         {{ $element.Path }}
  103         {{ with $element.Replace}}
  104         => {{ .Path }}
  105         {{ end }}
  106       </td>
  107       <td>{{ $element.Version }}</td>
  108       <td>{{ with $element.Time }}{{ . }}{{ end }}</td>
  109       <td>{{ $element.Vendor }}</td>
  110     </tr>
  111     {{ end }}
  112   </tbody>
  113 </table>
  114 ```