mirror of
https://github.com/thomasjsn/hugo-theme-hello-friend.git
synced 2024-11-14 04:15: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.
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
<span class="post-date">
|
<span class="post-date">
|
||||||
{{ .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 }}
|
||||||
@ -58,4 +58,4 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
{{ partial "pagination.html" . }}
|
{{ partial "pagination.html" . }}
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
<span class="post-date">
|
<span class="post-date">
|
||||||
{{ .Date.Format ($.Site.Params.DateFormatSingle | default "2006-01-02") }}
|
{{ .Date.Format ($.Site.Params.DateFormatSingle | default "2006-01-02") }}
|
||||||
</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 }}
|
||||||
@ -70,13 +70,13 @@
|
|||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
|
||||||
{{ if not (eq .Params.Comments "false") }}
|
{{ if not (eq .Params.Comments "false") }}
|
||||||
{{ if or (eq .Type $.Site.Params.contentTypeName) (.Params.Comments) }}
|
{{ if or (eq .Type $.Site.Params.contentTypeName) (.Params.Comments) }}
|
||||||
{{ partial "comments.html" . }}
|
{{ partial "comments.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{{ 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 }}
|
||||||
@ -6,4 +6,4 @@
|
|||||||
({{ $.Site.Params.LastModDisplay }} {{ .Format ($.Site.Params.DateFormatSingle | default "2006-01-02") }})
|
({{ $.Site.Params.LastModDisplay }} {{ .Format ($.Site.Params.DateFormatSingle | default "2006-01-02") }})
|
||||||
</span>
|
</span>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
Loading…
Reference in New Issue
Block a user