add last-modified date

Last modified date links to latest commit for the active page of 'doc'
type. Disabled by default keep with the minimalist theme.
This commit is contained in:
Nick Shine 2018-12-14 21:53:50 -06:00 committed by Alexander Shpak
parent 5c6070a423
commit 74f9dbf0cd
3 changed files with 21 additions and 6 deletions

View file

@ -7,6 +7,7 @@ theme: hugo-book
# Book configuration
disablePathToLower: true
enableGitInfo: false
params:
# show or hide table of contents for page
@ -14,12 +15,16 @@ params:
# Set bundle to render side menu
# if not specified file structure and weights will be used
BookMenuBundle: /menu
BookMenuBundle: /menu
# specify section of content to render as menu
# if bookMenuBundle is not set, 'docs' is value by default
BookSection: docs
# Set source repository location.
# Used for 'Last Modified' and 'Edit this page' links.
BookRepo: https://github.com/alex-shpak/hugo-book
# Enable "Edit this page" links for 'doc' page type.
# Disabled by default. Uncomment to enable.
# BookEditURL: https://github.com/alex-shpak/hugo-book/edit/master/exampleSite/content/
# Disabled by default. Uncomment to enable. Requires 'BookRepo' param.
# BookEditPath: edit/master/exampleSite/content

View file

@ -1,9 +1,18 @@
{{ with .Site.Params.BookEditURL }}
<div class="align-center book-git-footer justify-end">
{{ if or .GitInfo .Site.Params.BookEditPath }}
<div class="align-center book-git-footer {{ if not .GitInfo }}justify-end{{ else }}justify-between{{ end }}">
{{ with .GitInfo }}
<div>
<a href="{{ . }}{{ $.File.Path }}" target="_blank" rel="noopener">
<a href="{{ $.Site.Params.BookRepo }}/commit/{{ .Hash }}" title='Last modified {{ .AuthorDate.Local.Format "January 2, 2006 15:04 MST" }} by {{ .AuthorName }}' target="_blank" rel="noopener">
<img src="{{ "svg/code-merge.svg" | absURL }}" /> {{ .AuthorDate.Local.Format "Last Modified Jan 2, 2006" }}
</a>
</div>
{{ end }}
{{ with .Site.Params.BookEditPath }}
<div>
<a href="{{ $.Site.Params.BookRepo }}/{{ . }}/{{ $.File.Path }}" target="_blank" rel="noopener">
<img src="{{ "svg/code-fork.svg" | absURL }}" /> Edit this page
</a>
</div>
{{ end }}
</div>
{{ end }}

View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M5 18.184v-11.368c1.163-.413 2-1.511 2-2.816 0-1.657-1.343-3-3-3s-3 1.343-3 3c0 1.305.837 2.403 2 2.816v11.367c-1.163.414-2 1.512-2 2.817 0 1.657 1.343 3 3 3s3-1.343 3-3c0-1.305-.837-2.403-2-2.816zm-2.8-14.184c0-.993.807-1.8 1.8-1.8s1.8.807 1.8 1.8-.807 1.8-1.8 1.8-1.8-.807-1.8-1.8zm1.8 18.8c-.993 0-1.8-.807-1.8-1.8s.807-1.8 1.8-1.8 1.8.807 1.8 1.8-.807 1.8-1.8 1.8zm17-4.616v-11.184c0-2.206-1.794-4-4-4h-3v-3l-4 4 4 4v-3h3c1.103 0 2 .897 2 2v11.184c-1.163.413-2 1.512-2 2.816 0 1.657 1.343 3 3 3s3-1.343 3-3c0-1.305-.837-2.403-2-2.816zm-1 4.616c-.993 0-1.8-.807-1.8-1.8s.807-1.8 1.8-1.8 1.8.807 1.8 1.8-.807 1.8-1.8 1.8z"/></svg>

After

Width:  |  Height:  |  Size: 724 B