[ 
https://issues.apache.org/jira/browse/DRILL-4213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15071288#comment-15071288
 ] 

Kristine Hahn edited comment on DRILL-4213 at 12/25/15 12:52 AM:
-----------------------------------------------------------------

Adding the site.time liquid filter doesn't do what I thought. It updates the 
date each time you build the site. I propose the following solution:

In _layouts/docpage.html, I'll add this line after the page.title div:
{code}
{% unless page.nodate %} {{ page.date | date: "%b %-d, %Y" }}{% endunless %}
{code}

One-time local set-up for gh-pages writers:

1. In your cloned directory of Drill, in drill/.git/hooks, create a file named 
pre-commit that contains this script:
{code}
#!/bin/sh
# Contents of .git/hooks/pre-commit

git diff --cached --name-status | grep "^M" | while read a b; do
  cat $b | sed "/---.*/,/---.*/s/^date:.*$/date: $(date -u "+%Y-%m-%d %T %Z")/" 
> tmp
  mv tmp $b
  git add $b
done
{code}
2. Make the file executable.
{code}
chmod +x pre-commit
{code}
3. Add the date: to the front matter of any file you create or modify. For 
example:
{code}
---
title: "Configuring Multitenant Resources"
parent: "Configuring a Multitenant Cluster"
date: 
---
{code}
The pre-commit script will enter the UTC date (and time) when a modified file 
is committed, but the published file will show only month, day, year after the 
page title. For example:

*Configuring Multitenant Resources*

Dec 25, 2015

See example: 
http://kristinehahn.github.io/drill/docs/configuring-multitenant-resources/.



was (Author: krishahn):
Adding the site.time liquid filter doesn't do what I thought. It updates the 
date each time you build the site. I propose the following solution:

In _layouts/docpage.html, I'll add this line after the page.title div:
{code}
{% unless page.nodate %} {{ page.date | date: "%b %-d, %Y" }}{% endunless %}
{code}

One-time local set-up for gh-pages writers:

1. In your cloned directory of Drill, in drill/.git/hooks, create a file named 
pre-commit that contains this script:
{code}
#!/bin/sh
# Contents of .git/hooks/pre-commit

git diff --cached --name-status | grep "^M" | while read a b; do
  cat $b | sed "/---.*/,/---.*/s/^date:.*$/date: $(date -u "+%Y-%m-%d %T %Z")/" 
> tmp
  mv tmp $b
  git add $b
done
{code}
2. Make the file executable.
{code}
chmod +x pre-commit
{code}
3. Add the date: to the front matter of any file you create or modify. For 
example:
{code}
---
title: "Configuring Multitenant Resources"
parent: "Configuring a Multitenant Cluster"
date: 
---
{code}
The pre-commit script will enter the date (and UTC time) each time a modified 
file is committed, but the published file will show only month, day, year after 
the page title. For example:

*Configuring Multitenant Resources*

Dec 25, 2015

See example: 
http://kristinehahn.github.io/drill/docs/configuring-multitenant-resources/.


> add page last updated to Drill docs
> -----------------------------------
>
>                 Key: DRILL-4213
>                 URL: https://issues.apache.org/jira/browse/DRILL-4213
>             Project: Apache Drill
>          Issue Type: Improvement
>          Components: Documentation
>    Affects Versions: 1.4.0
>            Reporter: Kristine Hahn
>            Assignee: Kristine Hahn
>             Fix For: 1.5.0
>
>
> Received suggestion from community member to add a page last updated feature 
> to docs (see user list email Dec 18, 2015 "Documentation Changes: version and 
> date"). Maybe something like 
> https://github.com/gjtorikian/jekyll-last-modified-at?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to