feat(project): list associated posts

Close #767
This commit is contained in:
George Cushen committed 2018-11-03 22:37:36 +00:00
1 parent dd5422981b
commit 3d9a1277a8
9 files changed
+48 -12

No files matched your search

+8
View File
@@ -11,6 +11,14 @@ authors = []
tags = []
categories = []
# Projects (optional).
# Associate this post with one or more of your projects.
# Simply enter your project's folder or file name without extension.
# E.g. `projects = ["deep-learning"]` references
# `content/project/deep-learning/index.md`.
# Otherwise, set `projects = []`.
# projects = ["internal-project"]
# Featured image
# To use, add an image named `featured.jpg/png` to your page's folder.
[image]
+6
View File
@@ -212,6 +212,12 @@ enableGitInfo = false
# List publications and talks related to the project?
list_children = true
# Post list format.
# 0 = Simple
# 1 = Detailed
# 2 = Stream
post_format = 2
# Publication list format.
# 0 = Simple
# 1 = Detailed
@@ -12,6 +12,14 @@ authors = []
tags = ["Academic"]
summary = "Create a beautifully simple website or blog in under 10 minutes."
# Projects (optional).
# Associate this post with one or more of your projects.
# Simply enter your project's folder or file name without extension.
# E.g. `projects = ["deep-learning"]` references
# `content/project/deep-learning/index.md`.
# Otherwise, set `projects = []`.
# projects = ["internal-project"]
# Featured image
# To use, add an image named `featured.jpg/png` to your project's folder.
[image]
+1 -1
View File
@@ -45,7 +45,7 @@
<a href="{{ $.RelPermalink }}#disqus_thread"><!-- Count will be inserted here --></a>
{{ end}}
{{ if isset $.Params "categories" }}
{{ if $.Params.categories }}
{{ $categoriesLen := len $.Params.categories }}
{{ if gt $categoriesLen 0 }}
<span class="middot-divider"></span>
+1 -1
View File
@@ -1,4 +1,4 @@
{{ $post := .post }}
{{ $post := . }}
<div class="card-simple" itemscope itemprop="blogPost" itemtype="http://schema.org/BlogPosting">
{{ partial "page_metadata" (dict "content" $post "is_list" 1) }}
+1 -1
View File
@@ -1,4 +1,4 @@
{{ $post := .post }}
{{ $post := . }}
<div class="pub-list-item" itemscope itemprop="blogPost" itemtype="http://schema.org/BlogPosting">
<i class="far fa-newspaper pub-icon" aria-hidden="true"></i>
+1 -1
View File
@@ -1,4 +1,4 @@
{{ $post := .post }}
{{ $post := . }}
<div class="media stream-item" itemscope itemprop="blogPost" itemtype="http://schema.org/BlogPosting">
<div class="media-body">
+6 -8
View File
@@ -45,13 +45,12 @@
{{ $show_post := $.Scratch.Get "show_post" }}
{{ if ne $show_post "0" }}
{{ $params := dict "post" . }}
{{ if eq $page.Params.list_format 0 }}
{{ partial "post_li_simple" $params }}
{{ partial "post_li_simple" . }}
{{ else if eq $page.Params.list_format 1 }}
{{ partial "post_li_detailed" $params }}
{{ partial "post_li_detailed" . }}
{{ else }}
{{ partial "post_li_stream" $params }}
{{ partial "post_li_stream" . }}
{{ end }}
{{end}}
@@ -80,13 +79,12 @@
{{ $show_post := $.Scratch.Get "show_post" }}
{{ if ne $show_post "0" }}
{{ $params := dict "post" . }}
{{ if eq $page.Params.list_format 0 }}
{{ partial "post_li_simple" $params }}
{{ partial "post_li_simple" . }}
{{ else if eq $page.Params.list_format 1 }}
{{ partial "post_li_detailed" $params }}
{{ partial "post_li_detailed" . }}
{{ else }}
{{ partial "post_li_stream" $params }}
{{ partial "post_li_stream" . }}
{{ end }}
{{end}}
+16
View File
@@ -25,6 +25,22 @@
{{ $project_path := .RelPermalink }}
{{ if (.Site.Params.projects.list_children | default true) }}
{{ $items := where (where .Site.RegularPages "Type" "post") ".Params.projects" "intersect" (slice $project) }}
{{ $count := len $items }}
{{ if ge $count 1 }}
<h2>{{ (i18n "posts") }}</h2>
{{ range $items }}
{{ if eq $page.Site.Params.projects.post_format 0 }}
{{ partial "post_li_simple" . }}
{{ else if eq $page.Site.Params.projects.post_format 1 }}
{{ partial "post_li_detailed" . }}
{{ else }}
{{ partial "post_li_stream" . }}
{{ end }}
{{ end }}
{{ end }}
{{ $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 }}