posts: Support lastmod param to show date last modified

This commit is contained in:
George Cushen 2017-09-03 14:35:13 +01:00
commit 97590cb12e
9 changed files with 15 additions and 8 deletions

View file

@ -37,7 +37,7 @@ defaultContentLanguageInSubdir = false
# Date format (refer to Go's date format: http://flippinggodateformat.com ) # Date format (refer to Go's date format: http://flippinggodateformat.com )
# Examples: "Mon, Jan 2, 2006" or "2006-01-02" # Examples: "Mon, Jan 2, 2006" or "2006-01-02"
date_format = "Mon, Jan 2, 2006" date_format = "Jan 2, 2006"
# Enable global LaTeX math rendering? # Enable global LaTeX math rendering?
# If false, you can enable it locally on a per page basis. # If false, you can enable it locally on a per page basis.

View file

@ -1,6 +1,6 @@
+++ +++
title = "Posts" title = "Posts"
date = "2017-01-01T00:00:00Z" date = 2017-01-01
math = false math = false
highlight = false highlight = false

View file

@ -1,5 +1,6 @@
+++ +++
date = "2016-04-20T12:00:00" date = 2016-04-20
lastmod = 2017-09-03
draft = false draft = false
tags = ["academic", "hugo"] tags = ["academic", "hugo"]
title = "Getting started with the Academic framework for Hugo" title = "Getting started with the Academic framework for Hugo"

View file

@ -1,5 +1,5 @@
+++ +++
date = "2016-04-20T11:00:00" date = 2016-04-18
draft = false draft = false
tags = ["academic", "hugo"] tags = ["academic", "hugo"]
title = "Managing content" title = "Managing content"

View file

@ -1,5 +1,5 @@
+++ +++
date = "2014-03-10T00:00:00" date = 2014-03-10
draft = false draft = false
tags = ["jekyll"] tags = ["jekyll"]
title = "Migrate from Jekyll to Hugo" title = "Migrate from Jekyll to Hugo"

View file

@ -1,5 +1,5 @@
+++ +++
date = "2016-04-20T11:00:00" date = 2016-04-19
draft = false draft = false
tags = ["academic", "hugo"] tags = ["academic", "hugo"]
title = "Customizing the homepage with widgets" title = "Customizing the homepage with widgets"

View file

@ -1,5 +1,5 @@
+++ +++
date = "2016-04-20T10:00:00" date = 2016-04-17
draft = false draft = false
tags = [] tags = []
title = "Writing content with Markdown, LaTeX, and Shortcodes" title = "Writing content with Markdown, LaTeX, and Shortcodes"

View file

@ -66,6 +66,9 @@
- id: date - id: date
translation: Date translation: Date
- id: last_updated
translation: Last updated on
- id: links - id: links
translation: Links translation: Links

View file

@ -3,8 +3,11 @@
<div class="article-metadata"> <div class="article-metadata">
<span class="article-date"> <span class="article-date">
{{ if ne $.Params.Lastmod $.Params.Date }}
{{ i18n "last_updated" }}
{{ end }}
<time datetime="{{ $.Date }}" itemprop="datePublished"> <time datetime="{{ $.Date }}" itemprop="datePublished">
{{ $.Date.Format $.Site.Params.date_format }} {{ $.Lastmod.Format $.Site.Params.date_format }}
</time> </time>
</span> </span>