Inserting page last modified time inline

Hi! I need to display when the page last modified inline.

When using my own shortcode:

{{< time.inline >}}{{ dateFormat "Monday, Jan 2, 2006" .Params.LastMod }}{{< /time.inline >}}

I receive the following error message:

index.md:174:43": failed to render shortcode "time.inline": failed to process shortcode: template: _inline_shortcode/privacy/index.md/time.inline:1:43: executing "_inline_shortcode/privacy/index.md/time.inline" at <.Params.LastMod>: can't evaluate field LastMod in type interface {}

What am I missing please?

Use .Page.Lastmod instead of .Params.LastMod

you can define in your config file, where .LastMod comes from

example:

[frontmatter]
date                       = [ "date", ":filename", ":default"]
publishDate                = [ "publishDate", "date"]
lastmod                    = [ "lastmod", ":fileModTime", "publishDate"]
expiryDate                 = [ "expiryDate"]

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.