mirror of
https://github.com/thegeeklab/hugo-geekdoc.git
synced 2024-11-21 20:30:39 +00:00
feat: add parameter geekdocPageLastmod (#895)
This commit is contained in:
parent
bb6cf716b5
commit
15d3e40cdf
@ -11,6 +11,7 @@ geekdocTagsToMenu: true
|
|||||||
|
|
||||||
geekdocRepo: https://github.com/thegeeklab/hugo-geekdoc
|
geekdocRepo: https://github.com/thegeeklab/hugo-geekdoc
|
||||||
geekdocEditPath: edit/main/exampleSite
|
geekdocEditPath: edit/main/exampleSite
|
||||||
|
geekdocPageLastmod: false
|
||||||
|
|
||||||
geekdocSearch: true
|
geekdocSearch: true
|
||||||
geekdocSearchShowParent: true
|
geekdocSearchShowParent: true
|
||||||
|
@ -70,6 +70,10 @@ enableRobotsTXT = true
|
|||||||
# You can also specify this parameter per page in front matter.
|
# You can also specify this parameter per page in front matter.
|
||||||
geekdocEditPath = "edit/main/exampleSite"
|
geekdocEditPath = "edit/main/exampleSite"
|
||||||
|
|
||||||
|
# (Optional, default false) Show last modification date of the page in the header.
|
||||||
|
# Keep in mind that last modification date works best if `enableGitInfo` is set to true.
|
||||||
|
geekdocPageLastmod = true
|
||||||
|
|
||||||
# (Optional, default true) Enables search function with flexsearch.
|
# (Optional, default true) Enables search function with flexsearch.
|
||||||
# Index is built on the fly and might slow down your website.
|
# Index is built on the fly and might slow down your website.
|
||||||
geekdocSearch = false
|
geekdocSearch = false
|
||||||
@ -196,6 +200,10 @@ params:
|
|||||||
# You can also specify this parameter per page in front matter.
|
# You can also specify this parameter per page in front matter.
|
||||||
geekdocEditPath: edit/main/exampleSite
|
geekdocEditPath: edit/main/exampleSite
|
||||||
|
|
||||||
|
# (Optional, default false) Show last modification date of the page in the header.
|
||||||
|
# Keep in mind that last modification date works best if `enableGitInfo` is set to true.
|
||||||
|
geekdocPageLastmod: true
|
||||||
|
|
||||||
# (Optional, default true) Enables search function with flexsearch.
|
# (Optional, default true) Enables search function with flexsearch.
|
||||||
# Index is built on the fly and might slow down your website.
|
# Index is built on the fly and might slow down your website.
|
||||||
geekdocSearch: false
|
geekdocSearch: false
|
||||||
@ -294,6 +302,9 @@ geekdocRepo = "https://github.com/thegeeklab/hugo-geekdoc"
|
|||||||
# the parent directory of the 'content' folder.
|
# the parent directory of the 'content' folder.
|
||||||
geekdocEditPath = "edit/main/exampleSite"
|
geekdocEditPath = "edit/main/exampleSite"
|
||||||
|
|
||||||
|
# Show last modification date of the page in the header.
|
||||||
|
geekdocPageLastmod = true
|
||||||
|
|
||||||
# Used for 'Edit page' link, set to '.File.Path' by default.
|
# Used for 'Edit page' link, set to '.File.Path' by default.
|
||||||
# Can be overwritten by a path relative to 'geekdocEditPath'
|
# Can be overwritten by a path relative to 'geekdocEditPath'
|
||||||
geekdocFilePath =
|
geekdocFilePath =
|
||||||
@ -354,6 +365,9 @@ geekdocRepo: "https://github.com/thegeeklab/hugo-geekdoc"
|
|||||||
# the parent directory of the 'content' folder.
|
# the parent directory of the 'content' folder.
|
||||||
geekdocEditPath: "edit/main/exampleSite"
|
geekdocEditPath: "edit/main/exampleSite"
|
||||||
|
|
||||||
|
# Show last modification date of the page in the header.
|
||||||
|
geekdocPageLastmod: true
|
||||||
|
|
||||||
# Used for 'Edit page' link, set to '.File.Path' by default.
|
# Used for 'Edit page' link, set to '.File.Path' by default.
|
||||||
# Can be overwritten by a path relative to 'geekdocEditPath'
|
# Can be overwritten by a path relative to 'geekdocEditPath'
|
||||||
geekdocFilePath:
|
geekdocFilePath:
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
class="gdoc-markdown gdoc-markdown__align--{{ default "left" (.Page.Params.geekdocAlign | lower) }}"
|
class="gdoc-markdown gdoc-markdown__align--{{ default "left" (.Page.Params.geekdocAlign | lower) }}"
|
||||||
>
|
>
|
||||||
<h1>{{ partial "utils/title" . }}</h1>
|
<h1>{{ partial "utils/title" . }}</h1>
|
||||||
|
{{ partial "page-metadata" . }}
|
||||||
{{ partial "utils/content" . }}
|
{{ partial "utils/content" . }}
|
||||||
</article>
|
</article>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
13
layouts/partials/page-metadata.html
Normal file
13
layouts/partials/page-metadata.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{{- $showPageLastmod := (or (default false .Page.Params.geekdocPageLastmod) (default false .Site.Params.geekdocPageLastmod)) -}}
|
||||||
|
|
||||||
|
{{- if $showPageLastmod -}}
|
||||||
|
<span class="flex align-center no-wrap">
|
||||||
|
<svg class="gdoc-icon gdoc_date"><use xlink:href="#gdoc_date"></use></svg>
|
||||||
|
<time datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}">
|
||||||
|
{{ if .Lastmod.After (.Date.AddDate 0 0 1) }}
|
||||||
|
{{ i18n "posts_update_prefix" }}
|
||||||
|
{{ end }}
|
||||||
|
{{ .Lastmod.Format "Jan 2, 2006" }}
|
||||||
|
</time>
|
||||||
|
</span>
|
||||||
|
{{- end -}}
|
Loading…
Reference in New Issue
Block a user