Update the 'Customize Dates' example to not error (#1357)

Part of the work to improve the docs for users who are less familiar with GoLang by removing an error that would cause the template parser to throw with a `malformed character constant` Error as detailed in this issue https://github.com/gohugoio/hugo/issues/8322
This commit is contained in:
Paul Pineda 2021-03-13 01:26:15 +00:00 committed by GitHub
parent 1a14cc08a9
commit 52251fb420
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -421,13 +421,14 @@ At the time of this writing, Go does not yet have support for internationalized
...then index the non-English date names in your templates like so: ...then index the non-English date names in your templates like so:
~~~html ~~~html
<time class="post-date" datetime="{{ .Date.Format '2006-01-02T15:04:05Z07:00' | safeHTML }}"> <time class="post-date" datetime="{{ .Date.Format `2006-01-02T15:04:05Z07:00` | safeHTML }}">
Article publié le {{ .Date.Day }} {{ index $.Site.Data.mois (printf "%d" .Date.Month) }} {{ .Date.Year }} (dernière modification le {{ .Lastmod.Day }} {{ index $.Site.Data.mois (printf "%d" .Lastmod.Month) }} {{ .Lastmod.Year }}) Article publié le {{ .Date.Day }} {{ index $.Site.Data.mois (printf "%d" .Date.Month) }} {{ .Date.Year }} (dernière modification le {{ .Lastmod.Day }} {{ index $.Site.Data.mois (printf "%d" .Lastmod.Month) }} {{ .Lastmod.Year }})
</time> </time>
~~~ ~~~
This technique extracts the day, month and year by specifying ``.Date.Day``, ``.Date.Month``, and ``.Date.Year``, and uses the month number as a key, when indexing the month name data file. This technique extracts the day, month and year by specifying ``.Date.Day``, ``.Date.Month``, and ``.Date.Year``, and uses the month number as a key, when indexing the month name data file.
## Menus ## Menus
You can define your menus for each language independently. Creating multilingual menus works just like [creating regular menus][menus], except they're defined in language-specific blocks in the configuration file: You can define your menus for each language independently. Creating multilingual menus works just like [creating regular menus][menus], except they're defined in language-specific blocks in the configuration file: