diff options
author | Max Mehl <mail@mehl.mx> | 2020-10-31 21:30:48 +0300 |
---|---|---|
committer | Max Mehl <mail@mehl.mx> | 2020-10-31 21:30:48 +0300 |
commit | 8506a54b694f2c4850b37ce14f5885e13d4eb9cb (patch) | |
tree | 8f3ebe891332d615261ba59c8cdc4298a7c301fc | |
parent | e73ab513607dafbe0aa69a35c68610ad7bd108be (diff) |
add recent photos widget
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | i18n/de.yaml | 4 | ||||
-rw-r--r-- | i18n/en.yaml | 4 | ||||
-rw-r--r-- | layouts/partials/widgets/recent_photos.html | 15 |
4 files changed, 25 insertions, 1 deletions
@@ -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 }} +<div class="widget-recent widget"> + <h4 class="widget__title">{{ T "recent_photos_title" }}</h4> + <div class="widget__content"> + <ul class="widget__list"> + {{- range first $recent_num $recent }} + <li class="widget__item"><a class="widget__link" href="{{ .RelPermalink }}">{{ .Title }}</a></li> + {{- end }} + </ul> + </div> +</div> +{{- end }} |