Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hugo.WorkingDir to docs #2089

Merged
merged 1 commit into from
May 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 34 additions & 31 deletions content/en/functions/hugo.md
Original file line number Diff line number Diff line change
Expand Up @@ -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&nbsp;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

Expand All @@ -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".
Owner
: (`*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`).

Version (string)
: The module version.
Path
: (`string`) The module path or the path below your `themes` directory (e.g., `github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2`).

Vendor (bool)
: Whether this dependency is vendored.
Replace
: (`*hugo.Dependency`) Replaced by this dependency.

Time (time.Time)
: Time version was created.
Time
: (`time.Time`) The time that the version was created (e.g., `2022-02-13 15:11:28 +0000 UTC`).

Owner
: In the dependency tree, this is the first module that defines this module as a dependency.
Vendor
: (`bool`) Returns `true` if the dependency is vendored.

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