diff --git a/exampleSite/content/home/projects.md b/exampleSite/content/home/projects.md index 61aca8ee..70b496e7 100644 --- a/exampleSite/content/home/projects.md +++ b/exampleSite/content/home/projects.md @@ -18,6 +18,10 @@ weight = 50 view = 1 # Filter toolbar. + +# Default filter index (e.g. 0 corresponds to the first `[[filter]]` instance below). +filter_default = 0 + # Add or remove as many filters (`[[filter]]` instances) as you like. # Use "*" tag to show all projects or an existing tag prefixed with "." to filter by specific tag. # To remove toolbar, delete/comment all instances of `[[filter]]` below. diff --git a/layouts/partials/widgets/projects.html b/layouts/partials/widgets/projects.html index ec228eab..4adb056d 100644 --- a/layouts/partials/widgets/projects.html +++ b/layouts/partials/widgets/projects.html @@ -10,13 +10,18 @@
{{ with $page.Content }}

{{ . | markdownify }}

{{ end }} + {{ $filter_default := default (int $page.Params.filter_default) 0 }} + {{ with $page.Params.filter }} + + {{ end }} +
- {{ range $page.Params.filter }} - {{ .name }} - {{ end }} + {{ range $idx, $item := $page.Params.filter }} + {{ .name }} + {{ end }}
diff --git a/static/js/hugo-academic.js b/static/js/hugo-academic.js index 42bd0d9e..d425d61f 100644 --- a/static/js/hugo-academic.js +++ b/static/js/hugo-academic.js @@ -106,7 +106,8 @@ // Initialize Isotope after all images have loaded. $grid_projects.isotope({ itemSelector: '.isotope-item', - layoutMode: 'masonry' + layoutMode: 'masonry', + filter: $('#default-project-filter').text() }); // Filter items when filter link is clicked.