Add lastmod, Git commit info to pages
This commit is contained in:
@@ -307,9 +307,13 @@ paige:
|
|||||||
class: "text-center text-secondary" # Default is "text-center text-secondary"
|
class: "text-center text-secondary" # Default is "text-center text-secondary"
|
||||||
format: ":date_long" # Default is ":date_long"
|
format: ":date_long" # Default is ":date_long"
|
||||||
hide: false # Default is false
|
hide: false # Default is false
|
||||||
|
lastmod:
|
||||||
|
hide: false # Default is false
|
||||||
description:
|
description:
|
||||||
class: "lead text-center" # Default is "lead text-center"
|
class: "lead text-center" # Default is "lead text-center"
|
||||||
hide: false # Default is false
|
hide: false # Default is false
|
||||||
|
git:
|
||||||
|
commit_url_prefix: "https://github.com/willfaught/paige/commit/" # Default is ""
|
||||||
max_width: "100ch" # Default is ""
|
max_width: "100ch" # Default is ""
|
||||||
reading_time:
|
reading_time:
|
||||||
class: "text-center text-secondary" # Default is "text-center text-secondary"
|
class: "text-center text-secondary" # Default is "text-center text-secondary"
|
||||||
|
@@ -20,6 +20,14 @@
|
|||||||
{{ $titlelink := $page.Params.link }}
|
{{ $titlelink := $page.Params.link }}
|
||||||
{{ $titlepage := $page.RelPermalink }}
|
{{ $titlepage := $page.RelPermalink }}
|
||||||
|
|
||||||
|
{{ $commiturl := "" }}
|
||||||
|
{{ $lastmod := cond (eq $date $page.Lastmod) "" $page.Lastmod }}
|
||||||
|
{{ $lastmodshow := and $lastmod ($page.Param "paige.main.metadata.date.lastmod.hide" | not) }}
|
||||||
|
|
||||||
|
{{ if and ($page.Param "paige.main.metadata.git.commit_url_prefix") $page.GitInfo }}
|
||||||
|
{{ $commiturl = print ($page.Param "paige.main.metadata.git.commit_url_prefix") $page.GitInfo.Hash }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
<section {{ with $sectionclass }} class="{{ . }}" {{ end }}>
|
<section {{ with $sectionclass }} class="{{ . }}" {{ end }}>
|
||||||
{{ with $title }}
|
{{ with $title }}
|
||||||
<h1 {{ with $titleclass }} class="{{ . }}" {{ end }}>{{ with $titlelink }}<a href="{{ . }}">{{ . }}</a>{{ else }}{{ . }}{{ end }}{{ if $page.Scratch.Get "paige_list_show_content" }}<a aria-label="{{ i18n `paige_aria_page_link` }}" class="paige-header-link" href="{{ $titlepage }}">#</a>{{ end }}</h1>
|
<h1 {{ with $titleclass }} class="{{ . }}" {{ end }}>{{ with $titlelink }}<a href="{{ . }}">{{ . }}</a>{{ else }}{{ . }}{{ end }}{{ if $page.Scratch.Get "paige_list_show_content" }}<a aria-label="{{ i18n `paige_aria_page_link` }}" class="paige-header-link" href="{{ $titlepage }}">#</a>{{ end }}</h1>
|
||||||
@@ -53,7 +61,17 @@
|
|||||||
|
|
||||||
{{ with $date }}
|
{{ with $date }}
|
||||||
<p {{ if or $dateclass $readingtime }} class="{{ if $readingtime }} {{ $nogap }} {{ end }} {{ with $dateclass }} {{ . }} {{ end }}" {{ end }}>
|
<p {{ if or $dateclass $readingtime }} class="{{ if $readingtime }} {{ $nogap }} {{ end }} {{ with $dateclass }} {{ . }} {{ end }}" {{ end }}>
|
||||||
|
{{ if $lastmodshow }}
|
||||||
|
<time datetime="{{ .Format `2006-01-02` }}">{{ time.Format $dateformat . }}</time> · {{ with $commiturl }} <a class="link-secondary text-decoration-none" href="{{ . }}"> {{ end }} <time datetime="{{ .Format `2006-01-02` }}">{{ time.Format $dateformat $lastmod }}</time> {{ if $commiturl }} </a> {{ end }}
|
||||||
|
{{ else }}
|
||||||
|
{{ with $commiturl }}
|
||||||
|
<a class="link-secondary text-decoration-none" href="{{ . }}">
|
||||||
|
{{ end }}
|
||||||
<time datetime="{{ .Format `2006-01-02` }}">{{ time.Format $dateformat . }}</time>
|
<time datetime="{{ .Format `2006-01-02` }}">{{ time.Format $dateformat . }}</time>
|
||||||
|
{{ if $commiturl }}
|
||||||
|
</a>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
</p>
|
</p>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
@@ -36,6 +36,8 @@
|
|||||||
{{ $expired := and .ExpiryDate (lt .ExpiryDate now) }}
|
{{ $expired := and .ExpiryDate (lt .ExpiryDate now) }}
|
||||||
{{ $flags := slice }}
|
{{ $flags := slice }}
|
||||||
{{ $future := and .PublishDate (gt .PublishDate now) }}
|
{{ $future := and .PublishDate (gt .PublishDate now) }}
|
||||||
|
{{ $lastmod := cond (eq $date .Lastmod) "" .Lastmod }}
|
||||||
|
{{ $lastmodshow := and $lastmod ($page.Param "paige.main.metadata.date.lastmod.hide" | not) }}
|
||||||
{{ $modified := and .PublishDate .Lastmod (lt .PublishDate .Lastmod) }}
|
{{ $modified := and .PublishDate .Lastmod (lt .PublishDate .Lastmod) }}
|
||||||
{{ $readingtime := cond ($page.Param "paige.list.reading_time.hide" | not) .ReadingTime "" }}
|
{{ $readingtime := cond ($page.Param "paige.list.reading_time.hide" | not) .ReadingTime "" }}
|
||||||
{{ $readingtimeclass := $page.Param "paige.list.reading_time.class" | default "mb-0 paige-reading-time text-center text-secondary" }}
|
{{ $readingtimeclass := $page.Param "paige.list.reading_time.class" | default "mb-0 paige-reading-time text-center text-secondary" }}
|
||||||
@@ -49,6 +51,14 @@
|
|||||||
{{ $titleclass := $page.Param "paige.list.title.class" | default "mb-0 paige-title text-center" }}
|
{{ $titleclass := $page.Param "paige.list.title.class" | default "mb-0 paige-title text-center" }}
|
||||||
{{ $titlelink := .RelPermalink }}
|
{{ $titlelink := .RelPermalink }}
|
||||||
|
|
||||||
|
{{ $commiturl := "" }}
|
||||||
|
{{ $lastmod := cond (eq $date $page.Lastmod) "" $page.Lastmod }}
|
||||||
|
{{ $lastmodshow := and $lastmod ($page.Param "paige.main.metadata.date.lastmod.hide" | not) }}
|
||||||
|
|
||||||
|
{{ if and ($page.Param "paige.main.metadata.git.commit_url_prefix") $page.GitInfo }}
|
||||||
|
{{ $commiturl = print ($page.Param "paige.main.metadata.git.commit_url_prefix") $page.GitInfo.Hash }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{ if $draft }}
|
{{ if $draft }}
|
||||||
{{ $flags = $flags | append "paige-draft" "paige-unpublished" }}
|
{{ $flags = $flags | append "paige-draft" "paige-unpublished" }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
@@ -109,7 +119,17 @@
|
|||||||
|
|
||||||
{{ with $date }}
|
{{ with $date }}
|
||||||
<p {{ with $dateclass }} class="{{ . }}" {{ end }}>
|
<p {{ with $dateclass }} class="{{ . }}" {{ end }}>
|
||||||
|
{{ if $lastmodshow }}
|
||||||
|
<time datetime="{{ .Format `2006-01-02` }}">{{ time.Format $dateformat . }}</time> · {{ with $commiturl }} <a class="link-secondary text-decoration-none" href="{{ . }}"> {{ end }} <time datetime="{{ .Format `2006-01-02` }}">{{ time.Format $dateformat $lastmod }}</time> {{ if $commiturl }} </a> {{ end }}
|
||||||
|
{{ else }}
|
||||||
|
{{ with $commiturl }}
|
||||||
|
<a class="link-secondary text-decoration-none" href="{{ . }}">
|
||||||
|
{{ end }}
|
||||||
<time datetime="{{ .Format `2006-01-02` }}">{{ time.Format $dateformat . }}</time>
|
<time datetime="{{ .Format `2006-01-02` }}">{{ time.Format $dateformat . }}</time>
|
||||||
|
{{ if $commiturl }}
|
||||||
|
</a>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
</p>
|
</p>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user