Skip to content

Commit

Permalink
feat(portfolio): add filters for exclude_tags and page kind
Browse files Browse the repository at this point in the history
Experimental Portfolio widget support for:

content.filters.exclude_tags
content.filters.kinds
  • Loading branch information
gcushen committed May 11, 2022
1 parent 6b1f2f3 commit f9565e3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion wowchemy/layouts/partials/widgets/portfolio.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<div class="{{ if or $st.Params.content.filter_button (in (slice "masonry" 3) $view) }}isotope projects-container{{end}} {{if in (slice "masonry" 3) $view}}js-layout-masonry{{else}}row js-layout-row{{end}} {{ if eq $view "showcase" }}project-showcase{{end}}">

{{/* Query */}}
{{ $query := site.RegularPages }}
{{ $query := site.Pages }}

{{/* Filters */}}
{{ with $st.Params.content.page_type }}
Expand All @@ -63,6 +63,12 @@
{{ with $st.Params.content.filters.tags }}
{{ $query = where $query "Params.tags" "intersect" . }}
{{ end }}
{{ with $st.Params.content.filters.exclude_tags }}
{{ $query = $query | symdiff (where site.Pages "Params.tags" "intersect" .) }}
{{ end }}
{{ with ($st.Params.content.filters.kinds | default (slice "page")) }}
{{ $query = where $query "Kind" "in" . }}
{{ end }}

{{/* Sort */}}
{{ $sort_by := $st.Params.content.sort_by | default "Date" }}
Expand Down

0 comments on commit f9565e3

Please sign in to comment.