forked from gohugoio/hugoDocs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes gohugoio#2385
- Loading branch information
Showing
14 changed files
with
209 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
title: fmt.Warnidf | ||
description: Log a suppressable WARNING from a template. | ||
categories: [] | ||
keywords: [] | ||
action: | ||
aliases: [warnidf] | ||
related: | ||
- functions/fmt/Errorf | ||
- functions/fmt/Erroridf | ||
- functions/fmt/Warnf | ||
returnType: string | ||
signatures: ['fmt.Warnidf ID FORMAT [INPUT]'] | ||
aliases: [/functions/warnidf] | ||
--- | ||
|
||
{{< new-in 0.123.0 >}} | ||
|
||
{{% include "functions/fmt/_common/fmt-layout.md" %}} | ||
|
||
The `warnidf` function evaluates the format string, then prints the result to the WARNING log. Unlike the [`warnf`] function, you may suppress warnings logged by the `warnidf` function by adding the message ID to the `ignoreLogs` array in your site configuration. | ||
|
||
This template code: | ||
|
||
```go-html-template | ||
{{ warnidf "warning-42" "You should consider fixing this." }} | ||
``` | ||
|
||
Produces this console log: | ||
|
||
```text | ||
WARN You should consider fixing this. | ||
You can suppress this warning by adding the following to your site configuration: | ||
ignoreLogs = ['warning-42'] | ||
``` | ||
|
||
To suppress this message: | ||
|
||
{{< code-toggle file=hugo >}} | ||
ignoreLogs = ["warning-42"] | ||
{{< /code-toggle >}} | ||
|
||
[`warnf`]: /functions/fmt/warnf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
title: Lastmod | ||
description: Returns the last modification date of site content. | ||
categories: [] | ||
keywords: [] | ||
action: | ||
related: [] | ||
returnType: time.Time | ||
signatures: [SITE.Lastmod] | ||
--- | ||
|
||
{{< new-in 0.123.0 >}} | ||
|
||
The `Lastmod` method on a `Site` object returns a [`time.Time`] value. Use this with time [functions] and [methods]. For example: | ||
|
||
```go-html-template | ||
{{ .Site.Lastmod | time.Format ":date_long" }} → October 16, 2023 | ||
``` | ||
|
||
[`time.Time`]: https://pkg.go.dev/time#Time | ||
[functions]: /functions/time | ||
[methods]: /methods/time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.