From 8506a54b694f2c4850b37ce14f5885e13d4eb9cb Mon Sep 17 00:00:00 2001 From: Max Mehl Date: Sat, 31 Oct 2020 19:30:48 +0100 Subject: add recent photos widget --- README.md | 3 ++- i18n/de.yaml | 4 ++++ i18n/en.yaml | 4 ++++ layouts/partials/widgets/recent_photos.html | 15 +++++++++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 layouts/partials/widgets/recent_photos.html diff --git a/README.md b/README.md index d5e4715..53729b3 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,7 @@ theme = "hugo-dpsg" indexPager = false # Show pager navigation on index page post_meta = ["author", "date", "categories", "translations"] # Order of post meta information mainSections = ["post", "blog", "news"] # Specify section pages to show on home page and the "Recent articles" widget + photosSections = ["photos"] # Specify section pages to show on home page and the "Recent photos" widget dateformat = "02.01.2006" # Change the format of dates customCSS = ["css/custom.css"] # Include custom CSS files customJS = ["js/custom.js"] # Include custom JS files @@ -106,7 +107,7 @@ theme = "hugo-dpsg" list = "left" # Configure layout for list pages single = false # Configure layout for single pages # Enable widgets in given order - widgets = ["search", "recent", "categories", "taglist", "social", "languages"] + widgets = ["search", "recent", "recent_photos", "categories", "taglist", "social", "languages"] # alternatively "ddg-search" can be used, to search via DuckDuckGo # widgets = ["ddg-search", "recent", "categories", "taglist", "social", "languages"] diff --git a/i18n/de.yaml b/i18n/de.yaml index e94632c..a761fe7 100644 --- a/i18n/de.yaml +++ b/i18n/de.yaml @@ -53,6 +53,10 @@ - id: recent_title translation: "Letzte Beiträge" +# Recent Photos widget +- id: recent_photos_title + translation: "Neueste Fotos" + # Social widget - id: social_title translation: "Soziale Netzwerke" diff --git a/i18n/en.yaml b/i18n/en.yaml index 8c3a9a2..3cf75b3 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -53,6 +53,10 @@ - id: recent_title translation: "Recent Posts" +# Recent Photos widget +- id: recent_photos_title + translation: "Recent Photos" + # Social widget - id: social_title translation: "Social" diff --git a/layouts/partials/widgets/recent_photos.html b/layouts/partials/widgets/recent_photos.html new file mode 100644 index 0000000..455693e --- /dev/null +++ b/layouts/partials/widgets/recent_photos.html @@ -0,0 +1,15 @@ +{{- $recent := where .Site.RegularPages "Type" "in" .Site.Params.photoSections }} +{{- $recent_num := (.Site.Params.widgets.recent_num | default 10) }} + +{{- if $recent }} +
+

{{ T "recent_photos_title" }}

+
+
    + {{- range first $recent_num $recent }} +
  • {{ .Title }}
  • + {{- end }} +
+
+
+{{- end }} -- cgit v1.2.3