jbake-org / jbake

Java based open source static site/blog generator for developers & designers.
http://jbake.org
MIT License
1.11k stars 327 forks source link

Updated or revised date metadata for posts and pages #460

Open msgilligan opened 6 years ago

msgilligan commented 6 years ago

It would be nice if there were a standard, well-documented metadata item, in addition to post.date that can be set and displayed when a post/pages content is updated. The post will still be displayed on the existing URL and have the original post.date value, but an "Update YY/MM/DD" field can be added to the template.

manikmagar commented 6 years ago

In my opinion, this is no different than any other custom metadata header. Here is how I do it for my site -

  1. I add lastupdated attribute and set it's value to content update date. The original date remains unchanged, and so the page location.

Manik Magar v1.0, 2018-02-18 :toc: preamble :toclevels: 2 :jbake-lastupdated: 2018-03-29 :jbake-type: post :jbake-status: published

  1. The inside my template, I display last updated date if exists - <#if (post.lastupdated??)>Last Updated - ${post.lastupdated?date("yyyy-MM-dd")?string('MMMM, dd yyyy')}</#if>

Output can be seen on here - https://javastreets.com/blog/run-mule4-in-docker-container.html

image

Do you mean, documentation should callout possible use of attribute like lastUpdate?

msgilligan commented 6 years ago

Nice @manikmagar !

The advantage to being a standard metadata header is that standard templates could use it. 😀

jonbullock commented 6 years ago

As I was reading this my first thought was could we use the timestamp of the source content file as a standard metadata variable, but I'm not sure if you were using CI to automate if all files would have the same timestamp.