mirror of
https://github.com/thomasjsn/hugo-theme-hello-friend.git
synced 2024-11-14 12:25:07 +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 start](#how-to-start)
|
||||||
- [How to configure](#how-to-configure)
|
- [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 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)
|
- [Add-ons](#add-ons)
|
||||||
- [How to run your site](#how-to-run-your-site)
|
- [How to run your site](#how-to-run-your-site)
|
||||||
- [How to edit the theme](#how-to-edit-the-theme)
|
- [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
|
* 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`
|
* 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.
|
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.
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
{{ .Date.Format ($.Site.Params.DateFormatList | default "2006-01-02") }}
|
{{ .Date.Format ($.Site.Params.DateFormatList | default "2006-01-02") }}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
{{ if $.Site.Params.LastModDisplay}}
|
{{ if $.Site.Params.LastModDisplay }}
|
||||||
{{ partial "lastmod.html" . }}
|
{{ partial "lastmod.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
{{ if eq .Type $contentTypeName }}
|
{{ if eq .Type $contentTypeName }}
|
||||||
{{ if $.Site.Params.LastModDisplay}}
|
{{ if $.Site.Params.LastModDisplay }}
|
||||||
{{ partial "lastmod.html" . }}
|
{{ partial "lastmod.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{{$hourInSec := 3600}}
|
{{ $hourInSec := 3600 }}
|
||||||
|
|
||||||
{{ if gt .Lastmod (add (time .Date).Unix $hourInSec) }}
|
{{ if gt .Lastmod (add (time .Date).Unix $hourInSec) }}
|
||||||
{{ with .Lastmod }}
|
{{ with .Lastmod }}
|
||||||
|
Loading…
Reference in New Issue
Block a user