Skip to content

Commit

Permalink
You can now display last updated time for the entire site
Browse files Browse the repository at this point in the history
Default is off, and you can turn it on via `display_site_lastmod`. See configuration parameters. On demo page it is turned on.
  • Loading branch information
harrymkt committed Jan 15, 2025
1 parent 8893e3b commit 564bb6e
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 4 deletions.
5 changes: 3 additions & 2 deletions config/_default/params.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
title_sep: ""
no_js: false
display_site_lastmod: false
search:
enable: true
default_enable: true
format: pagefind
no_js: false
format: pagefind
2 changes: 2 additions & 0 deletions demo/content/docs/params/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ The title's seperator to use. Default is " – ".
## no_js
Toggles whether JavaScript is disabled. Defaults to `false`.

## display_site_lastmod
Toggles whether the entire site last updated date should display. Defaults to `false`.
## search
Search configuration options:
- `enable`(bool): Toggles search. Defaults to `true`
Expand Down
5 changes: 4 additions & 1 deletion demo/hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ menus:
- name: "Authors"
pageRef: "/authors"
identifier: menu_main_author
weight: 40
weight: 40

params:
display_site_lastmod: true
1 change: 1 addition & 0 deletions i18n/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ mainmenu: "Main Menu"
published_on: "Published on {{ . }}"
lastmod: "Updated on {{ . }}"
lastmod_short: "Last Modified: {{ . }} ago"
site_lastmod: "This site is last updated {{ . }} ago"
menu_main_home: "Home"
menu_main_blog: "Posts"
menu_main_doc: "Documentation"
Expand Down
1 change: 1 addition & 0 deletions i18n/my.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ mainmenu: "ပုံသေ မီနူး"
published_on: "တွင်ထုတ်ဝေခဲ့သည်။ {{ . }}"
lastmod: "အပ်ဒိတ်လုပ်ထားသည် {{ . }}"
lastmod_short: "နောက်ဆုံးပြင်ဆင်ထားသည်: {{ . }} လွန်ခဲ့သော"
site_lastmod: "ဤဆိုက်ကို နောက်ဆုံးမွမ်းမံထားသည် {{ . }} ပြီးခဲ့သော"
menu_main_home: ပင်မစာမျက်နှာ
menu_main_blog: စာတိုက်
menu_main_doc: "Documentation"
Expand Down
9 changes: 9 additions & 0 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,14 @@
{{- end }}
{{- block "extrafooter" . }}
{{- end }}
{{- $dsud := .Site.Params.display_site_lastmod | default false }}
{{- if $dsud }}
{{- if not $nojs }}
{{- $slmd := printf "<script>document.write(ts_to_readable_time(get_timestamp(%q), false, %q, false));</script>" .Site.Lastmod "" }}
<p>{{ T "site_lastmod" $slmd | safeHTML }}</p>
{{- else }}
<p>{{ partial "content.html" (dict "page" .Site "value" "%updated%") }}</p>
{{- end }}
{{- end }}
</body>
</html>
3 changes: 2 additions & 1 deletion newest-unreleased-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
- Added ability to add heading ID to documentation pages frontmadder.
- Added SEO HTML tags.
- Added the ability to set image or logo for a specific page that uses listpost partial. See frontmadder configuration variables section.
- Added `linktitle` content variable.
- Added `linktitle` content variable.
- You can now display last updated time for the entire site. Default is off, and you can turn it on via `display_site_lastmod`. See configuration parameters. On demo page it is turned on.

0 comments on commit 564bb6e

Please sign in to comment.