diff --git a/README.md b/README.md index 422565bc..f7e1bc98 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ Set `[params.application]` to advertise your site's own release version in the d name = "My App" ``` -This renders ``. The version resolves from `params.application.version`, else the `HUGO_APPLICATION_VERSION` environment variable (set this in your build / CI pipeline), else the short Git commit hash when `enableGitInfo` is on. Sites that omit `[params.application]` render no such tag. +This renders ``. The version resolves from `params.application.version`, else the `HUGO_APPLICATION_VERSION` environment variable (set this in your build / CI pipeline). Sites that omit `[params.application]`, or that set neither a config value nor the environment variable, render no such tag. ## Contributing diff --git a/layouts/_partials/assets/app-version.html b/layouts/_partials/assets/app-version.html index 2b1c3888..e94af7b6 100644 --- a/layouts/_partials/assets/app-version.html +++ b/layouts/_partials/assets/app-version.html @@ -8,8 +8,8 @@ tag. Precedence: 1. site.Params.application.version (explicit config override) 2. HUGO_APPLICATION_VERSION env var (CI / build injection) - 3. hugo.CommitHash (short) (local builds with enableGitInfo) - Returns an empty string when none resolve. A leading "v" is stripped. */}} + Returns an empty string when neither resolves (no tag is rendered). + A leading "v" is stripped. */}} {{- define "_partials/inline/env-app-version.html" -}} {{- return getenv "HUGO_APPLICATION_VERSION" -}} {{- end -}} @@ -21,8 +21,5 @@ {{- if not $version -}} {{- $version = partial "inline/env-app-version.html" . -}} {{- end -}} -{{- if not $version -}} - {{- with hugo.CommitHash -}}{{- $version = printf "g%s" (substr . 0 7) -}}{{- end -}} -{{- end -}} {{- $version = $version | default "" | strings.TrimPrefix "v" -}} {{- print $version -}}