Display tags (if set) for all content types

Close #363
This commit is contained in:
George Cushen 2017-10-31 20:25:05 +00:00
commit 6b7202c7bc
7 changed files with 62 additions and 44 deletions

View file

@ -37,6 +37,10 @@ selected = false
# E.g. `projects = ["deep-learning"]` references `content/project/deep-learning.md`.
projects = []
# Tags (optional).
# Set `tags = []` for no tags, or use the form `tags = ["A Tag", "Another Tag"]` for one or more tags.
tags = []
# Links (optional).
url_pdf = ""
url_preprint = ""

View file

@ -28,6 +28,10 @@ selected = false
# E.g. `projects = ["deep-learning"]` references `content/project/deep-learning.md`.
projects = []
# Tags (optional).
# Set `tags = []` for no tags, or use the form `tags = ["A Tag", "Another Tag"]` for one or more tags.
tags = []
# Links (optional).
url_pdf = ""
url_slides = ""

View file

@ -6,23 +6,17 @@
{{ partial "header_image.html" . }}
<div class="article-container">
<h1 itemprop="name">{{ .Title }}</h1>
{{ partial "article_metadata" (dict "content" . "is_list" 0) }}
<div class="article-style" itemprop="articleBody">
{{ .Content }}
</div>
<div class="article-inner">
<h1 itemprop="name">{{ .Title }}</h1>
{{ if isset $.Params "tags" }}
{{ $tagsLen := len $.Params.tags }}
{{ if gt $tagsLen 0 }}
<div class="article-tags">
{{ range $k, $v := $.Params.tags }}
<a class="btn btn-primary btn-outline" href="{{ "/tags/" | relLangURL }}{{ . | urlize | lower }}">{{ . }}</a>
{{ end }}
</div>
{{ end }}
{{ end }}
{{ partial "article_metadata" (dict "content" . "is_list" 0) }}
<div class="article-style" itemprop="articleBody">
{{ .Content }}
</div>
{{ partial "tags.html" . }}
</div>
</div>
</article>

View file

@ -0,0 +1,10 @@
{{ if isset $.Params "tags" }}
{{ $tagsLen := len $.Params.tags }}
{{ if gt $tagsLen 0 }}
<div class="article-tags">
{{ range $k, $v := $.Params.tags }}
<a class="btn btn-primary btn-outline" href="{{ "/tags/" | relLangURL }}{{ . | urlize | lower }}">{{ . }}</a>
{{ end }}
</div>
{{ end }}
{{ end }}

View file

@ -21,42 +21,44 @@
<div class="article-style" itemprop="articleBody">
{{ .Content }}
</div>
{{ $page := . }}
{{ $project := .File.TranslationBaseName }}
{{ $project_path := printf "%s/%s/" .Section $project }}
{{ partial "tags.html" . }}
{{ if (.Site.Params.projects.list_children | default true) }}
{{ $items := where (where .Site.RegularPages "Type" "publication") ".Params.projects" "intersect" (slice $project) }}
{{ $items := $items | union (where (where .Site.RegularPages "Type" "publication") ".Params.url_project" $project_path) }}
{{ $pubs_len := len $items }}
{{ if ge $pubs_len 1 }}
<h2>{{ (i18n "publications") }}</h2>
{{ range $items }}
{{ if eq $page.Site.Params.projects.publication_format 1 }}
{{ partial "publication_li_detailed" . }}
{{ else if eq $page.Site.Params.projects.publication_format 2 }}
{{ partial "publication_li_apa" . }}
{{ else if eq $page.Site.Params.projects.publication_format 3 }}
{{ partial "publication_li_mla" . }}
{{ else }}
{{ partial "publication_li_simple" . }}
{{ end }}
{{ end }}
{{ end }}
{{ $page := . }}
{{ $project := .File.TranslationBaseName }}
{{ $project_path := printf "%s/%s/" .Section $project }}
{{ $items := where (where .Site.RegularPages "Type" "talk") ".Params.projects" "intersect" (slice $project) }}
{{ $items := $items | union (where (where .Site.RegularPages "Type" "publication") ".Params.url_project" $project_path) }}
{{ $talks_len := len $items }}
{{ if ge $talks_len 1 }}
<h2>{{ (i18n "talks") }}</h2>
{{ range $items }}
{{ partial "talk_li_simple" . }}
{{ if (.Site.Params.projects.list_children | default true) }}
{{ $items := where (where .Site.RegularPages "Type" "publication") ".Params.projects" "intersect" (slice $project) }}
{{ $items := $items | union (where (where .Site.RegularPages "Type" "publication") ".Params.url_project" $project_path) }}
{{ $pubs_len := len $items }}
{{ if ge $pubs_len 1 }}
<h2>{{ (i18n "publications") }}</h2>
{{ range $items }}
{{ if eq $page.Site.Params.projects.publication_format 1 }}
{{ partial "publication_li_detailed" . }}
{{ else if eq $page.Site.Params.projects.publication_format 2 }}
{{ partial "publication_li_apa" . }}
{{ else if eq $page.Site.Params.projects.publication_format 3 }}
{{ partial "publication_li_mla" . }}
{{ else }}
{{ partial "publication_li_simple" . }}
{{ end }}
{{ end }}
{{ end }}
</div>
{{ $items := where (where .Site.RegularPages "Type" "talk") ".Params.projects" "intersect" (slice $project) }}
{{ $items := $items | union (where (where .Site.RegularPages "Type" "publication") ".Params.url_project" $project_path) }}
{{ $talks_len := len $items }}
{{ if ge $talks_len 1 }}
<h2>{{ (i18n "talks") }}</h2>
{{ range $items }}
{{ partial "talk_li_simple" . }}
{{ end }}
{{ end }}
{{ end }}
</div>
</article>

View file

@ -91,6 +91,8 @@
<div class="article-style">{{ .Content }}</div>
{{ partial "tags.html" . }}
</div>
</div>

View file

@ -102,6 +102,8 @@
{{ .Content }}
</div>
{{ partial "tags.html" . }}
</div>
</div>