project widget: Enable content from any folder to be displayed

The widget is no longer limited to only displaying content from `content/project/` folder.

See #429
This commit is contained in:
Dongdong Tian 2018-01-05 06:34:04 +08:00 committed by gcushen
commit 4167651b58
2 changed files with 8 additions and 4 deletions

View file

@ -1,6 +1,5 @@
+++
# Projects widget.
# This widget displays all projects from `content/project/`.
widget = "projects"
active = true
date = "2016-04-20T00:00:00"
@ -11,6 +10,11 @@ subtitle = ""
# Order that this section will appear in.
weight = 50
# Content.
# Display content from the following folder.
# For example, `folder = "project"` displays content from `content/project/`.
folder = "project"
# View.
# Customize how projects are displayed.
# Legend: 0 = list, 1 = cards.
@ -27,7 +31,7 @@ filter_default = 0
[[filter]]
name = "All"
tag = "*"
[[filter]]
name = "Deep Learning"
tag = ".deep-learning"

View file

@ -34,7 +34,7 @@
{{ if eq $page.Params.view 0 }}
<div class="row isotope projects-container js-layout-row">
{{ range where $.Site.RegularPages "Type" "project" }}
{{ range where $.Site.RegularPages "Type" ($page.Params.folder | default "project") }}
<div class="col-md-12 project-item isotope-item {{ delimit .Params.tags " " }}" itemscope itemtype="http://schema.org/CreativeWork">
<i class="fa fa-files-o pub-icon" aria-hidden="true"></i>
@ -56,7 +56,7 @@
<div class="row isotope projects-container js-layout-masonry">
{{ range $project := where $.Site.RegularPages "Type" "project" }}
{{ range $project := where $.Site.RegularPages "Type" ($page.Params.folder | default "project") }}
{{ $.Scratch.Set "project_url" $project.Permalink }}
{{ $.Scratch.Set "target" "" }}
{{ if $project.Params.external_link }}