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:
parent
5c6070a423
commit
74f9dbf0cd
3 changed files with 21 additions and 6 deletions
|
@ -7,6 +7,7 @@ theme: hugo-book
|
||||||
|
|
||||||
# Book configuration
|
# Book configuration
|
||||||
disablePathToLower: true
|
disablePathToLower: true
|
||||||
|
enableGitInfo: false
|
||||||
|
|
||||||
params:
|
params:
|
||||||
# show or hide table of contents for page
|
# show or hide table of contents for page
|
||||||
|
@ -20,6 +21,10 @@ params:
|
||||||
# if bookMenuBundle is not set, 'docs' is value by default
|
# if bookMenuBundle is not set, 'docs' is value by default
|
||||||
BookSection: docs
|
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.
|
# Enable "Edit this page" links for 'doc' page type.
|
||||||
# Disabled by default. Uncomment to enable.
|
# Disabled by default. Uncomment to enable. Requires 'BookRepo' param.
|
||||||
# BookEditURL: https://github.com/alex-shpak/hugo-book/edit/master/exampleSite/content/
|
# BookEditPath: edit/master/exampleSite/content
|
||||||
|
|
|
@ -1,9 +1,18 @@
|
||||||
{{ with .Site.Params.BookEditURL }}
|
{{ if or .GitInfo .Site.Params.BookEditPath }}
|
||||||
<div class="align-center book-git-footer justify-end">
|
<div class="align-center book-git-footer {{ if not .GitInfo }}justify-end{{ else }}justify-between{{ end }}">
|
||||||
|
{{ with .GitInfo }}
|
||||||
<div>
|
<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
|
<img src="{{ "svg/code-fork.svg" | absURL }}" /> Edit this page
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
1
static/svg/code-merge.svg
Normal file
1
static/svg/code-merge.svg
Normal 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 |
Loading…
Reference in a new issue