Browse Source

feat(widget): allow to constrain Portfolio by set of tags

George Cushen 4 years ago
parent
commit
b0ffb4ddc7
1 changed files with 9 additions and 1 deletions
  1. 9 1
      wowchemy/layouts/partials/widgets/portfolio.html

+ 9 - 1
wowchemy/layouts/partials/widgets/portfolio.html

@@ -47,7 +47,15 @@
   {{ end }}
 
   <div class="{{ if or $st.Params.content.filter_button (eq $st.Params.design.view 3) }}isotope projects-container{{end}} {{if eq $st.Params.design.view 3}}js-layout-masonry{{else}}row js-layout-row{{end}} {{ if eq $st.Params.design.view 5 }}project-showcase mt-5{{end}}">
-    {{ range $idx, $item := where site.RegularPages "Type" $items_type }}
+
+    {{ $query := "" }}
+    {{ if $st.Params.content.filters.tags }}
+      {{ $query = where site.Pages "Params.tags" "intersect" $st.Params.content.filters.tags }}
+    {{ else }}
+      {{ $query = where site.RegularPages "Type" $items_type }}
+    {{ end }}
+
+    {{ range $idx, $item := $query }}
 
       {{ $link := $item.RelPermalink }}
       {{ $target := "" }}