mirror of
https://github.com/thomasjsn/hugo-theme-hello-friend.git
synced 2024-11-13 03:45:08 +01:00
Small fixes to lastMod feature
This commit is contained in:
parent
853c16dac3
commit
7a69ffcdf8
@ -16,6 +16,7 @@ This theme is pretty basic and covers all of the essentials. All you have to do
|
||||
- [How to start](#how-to-start)
|
||||
- [How to configure](#how-to-configure)
|
||||
- [How to add a cover image to your posts](#how-to-add-a-cover-image-to-your-posts)
|
||||
- [How to display the Last Modified Date in your posts](#how-to-display-the-last-modified-date-in-your-posts)
|
||||
- [Add-ons](#add-ons)
|
||||
- [How to run your site](#how-to-run-your-site)
|
||||
- [How to edit the theme](#how-to-edit-the-theme)
|
||||
@ -137,7 +138,7 @@ Adding a cover image to your post is simple and there are two options when you e
|
||||
* Use `cover = "img.jpg"` and `useRelativeCover = true` to link the image relative to the blog post folder
|
||||
* Resulting in `https://www.yourpage.com/posts/blog-entry-xy/img.jpg`
|
||||
|
||||
# How to display the Last Modified Date in your posts
|
||||
## How to display the Last Modified Date in your posts
|
||||
|
||||
Add `lastModDisplay = "[your display text]"` to `config.toml` to enable last modified date on your posts. Note - an empty string value `""` does not display anything.
|
||||
|
||||
|
@ -17,8 +17,8 @@
|
||||
<span class="post-date">
|
||||
{{ .Date.Format ($.Site.Params.DateFormatList | default "2006-01-02") }}
|
||||
</span>
|
||||
|
||||
{{ if $.Site.Params.LastModDisplay}}
|
||||
|
||||
{{ if $.Site.Params.LastModDisplay }}
|
||||
{{ partial "lastmod.html" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
@ -58,4 +58,4 @@
|
||||
{{ end }}
|
||||
{{ partial "pagination.html" . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
@ -9,9 +9,9 @@
|
||||
<span class="post-date">
|
||||
{{ .Date.Format ($.Site.Params.DateFormatSingle | default "2006-01-02") }}
|
||||
</span>
|
||||
|
||||
|
||||
{{ if eq .Type $contentTypeName }}
|
||||
{{ if $.Site.Params.LastModDisplay}}
|
||||
{{ if $.Site.Params.LastModDisplay }}
|
||||
{{ partial "lastmod.html" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
@ -70,13 +70,13 @@
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
|
||||
{{ if not (eq .Params.Comments "false") }}
|
||||
{{ if or (eq .Type $.Site.Params.contentTypeName) (.Params.Comments) }}
|
||||
{{ partial "comments.html" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{{$hourInSec := 3600}}
|
||||
{{ $hourInSec := 3600 }}
|
||||
|
||||
{{ if gt .Lastmod (add (time .Date).Unix $hourInSec) }}
|
||||
{{ with .Lastmod }}
|
||||
@ -6,4 +6,4 @@
|
||||
({{ $.Site.Params.LastModDisplay }} {{ .Format ($.Site.Params.DateFormatSingle | default "2006-01-02") }})
|
||||
</span>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
Loading…
Reference in New Issue
Block a user