refactor(project): projects not listing child pages

Simplify code to get content name by using `.File.ContentBaseName` -
it gets content name irrespective of whether page is a bundle or not.

See #800

BREAKING CHANGE

`url_project` can now only be used to link pages to external websites.
To link a page to a project page, use `projects` option.
This commit is contained in:
George Cushen committed 2018-11-29 21:01:37 +00:00
1 parent 935e31470d
commit 8010d5a45c
3 files changed
+2 -13

No files matched your search

-1
View File
@@ -25,7 +25,6 @@ external_link = ""
url_pdf = ""
url_code = ""
url_dataset = ""
url_project = ""
url_slides = ""
url_video = ""
url_poster = ""
@@ -45,7 +45,7 @@ url_pdf = "http://eprints.soton.ac.uk/352095/1/Cushen-IMV2013.pdf"
url_preprint = "http://eprints.soton.ac.uk/352095/1/Cushen-IMV2013.pdf"
url_code = "#"
url_dataset = "#"
url_project = "#"
url_project = ""
url_slides = "#"
url_video = "#"
url_poster = "#"
+1 -11
View File
@@ -15,15 +15,7 @@
{{ partial "page_author.html" . }}
{{ $page := . }}
{{ $project := .Slug }}
{{ if not $project }}{{/* If user did not explicitly set `slug` in front matter. */}}
{{ $project = .File.TranslationBaseName }}
{{ end }}
{{ if eq $project "index" }}{{/* Check if using dir-based page bundles. */}}
{{ $dir_sep := substr .Dir -1 1 }}
{{ $project = delimit (last 1 (split (substr .Dir 0 -1) $dir_sep)) "" }}
{{ end }}
{{ $project_path := .RelPermalink }}
{{ $project := .File.ContentBaseName }}
{{ if (.Site.Params.projects.list_children | default true) }}
@@ -43,7 +35,6 @@
{{ 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 }}
{{ if ge $pubs_len 1 }}
<h2>{{ (i18n "publications") }}</h2>
@@ -63,7 +54,6 @@
{{ end }}
{{ $items := where (where .Site.RegularPages "Type" "talk") ".Params.projects" "intersect" (slice $project) }}
{{ $items := $items | union (where (where .Site.RegularPages "Type" "talk") ".Params.url_project" $project_path) }}
{{ $talks_len := len $items }}
{{ if ge $talks_len 1 }}
<h2>{{ (i18n "talks") }}</h2>