From 09fa1bc4e8abcfd83a301d05598dcaa03aa594e1 Mon Sep 17 00:00:00 2001 From: Anthony Fok Date: Thu, 3 May 2018 00:32:49 -0600 Subject: [PATCH] Clarify that `.Now` is obsolete And fix typo: `now` should be without leading dot. Fixes #470 --- content/en/functions/now.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/content/en/functions/now.md b/content/en/functions/now.md index fcd86231e..8c706835b 100644 --- a/content/en/functions/now.md +++ b/content/en/functions/now.md @@ -21,7 +21,7 @@ aliases: [] See [`time.Time`](https://godoc.org/time#Time). -For example, building your site on June 24, 2017 with the following templating: +For example, building your site on June 24, 2017, with the following templating: ```
@@ -29,7 +29,7 @@ For example, building your site on June 24, 2017 with the following templating:
``` -Which will produce the following: +would produce the following: ```
@@ -40,5 +40,11 @@ Which will produce the following: The above example uses the [`.Format` function](/functions/format), which page includes a full listing of date formatting using Golang's layout string. {{% note %}} -Older Hugo themes may use the deprecated `.Now` (uppercase). Be sure to use the lowercase `.now` in your templating. +Older Hugo themes may still be using the obsolete Page’s `.Now` (uppercase with leading dot), which causes build error that looks like the following: + + ERROR ... Error while rendering "..." in "...": ... + executing "..." at <.Now.Format>: + can't evaluate field Now in type *hugolib.PageOutput + +Be sure to use `now` (lowercase with _**no**_ leading dot) in your templating. {{% /note %}}