Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/pfadfinder-konstanz/hugo-dpsg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormax.mehl <max.mehl@fsfe.org>2021-08-29 16:34:21 +0300
committermax.mehl <max.mehl@fsfe.org>2021-08-29 16:34:21 +0300
commit4deb8681a9c1a5b3ad2e0b49a58da5acbe0b2ee7 (patch)
treea6c301c2fadd24727ff81f0d8d8abfa94ee39053
parent4dc0b0094baf24b002b0d3fd06a89ba1747e56e6 (diff)
new sidebar widget to select one tag for photos
-rw-r--r--README.md3
-rw-r--r--layouts/partials/widgets/recent.html2
-rw-r--r--layouts/partials/widgets/recent_photos_tags.html15
3 files changed, 18 insertions, 2 deletions
diff --git a/README.md b/README.md
index d45312b..8446c93 100644
--- a/README.md
+++ b/README.md
@@ -89,6 +89,7 @@ theme = "hugo-dpsg"
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
+ photoTag = "photos" # Specify one tag to show on home page and the "Recent photos" widget. Similar as photoSections, but with 1 tag instead of 1 or multiple sections
dateformat = "02.01.2006" # Change the format of dates
customCSS = ["css/custom.css"] # Include custom CSS files, can also be used per-page as front matter attribute
customJS = ["js/custom.js"] # Include custom JS files
@@ -109,7 +110,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", "recent_photos", "categories", "taglist", "social", "languages"]
+ widgets = ["search", "recent", "recent_photos", "recent_photos_tags", "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/layouts/partials/widgets/recent.html b/layouts/partials/widgets/recent.html
index 39721b7..c264062 100644
--- a/layouts/partials/widgets/recent.html
+++ b/layouts/partials/widgets/recent.html
@@ -12,4 +12,4 @@
</ul>
</div>
</div>
-{{- end }} \ No newline at end of file
+{{- end }}
diff --git a/layouts/partials/widgets/recent_photos_tags.html b/layouts/partials/widgets/recent_photos_tags.html
new file mode 100644
index 0000000..eb69ebe
--- /dev/null
+++ b/layouts/partials/widgets/recent_photos_tags.html
@@ -0,0 +1,15 @@
+{{- $recent := .Site.RegularPages.RelatedTo ( keyVals "tags" .Site.Params.photoTag) }}
+{{- $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 }}