From 8010d5a45ccdf7beed63cbd0a3c64daafdf0defe Mon Sep 17 00:00:00 2001 From: George Cushen Date: Thu, 29 Nov 2018 21:01:37 +0000 Subject: [PATCH] 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. --- archetypes/project/index.md | 1 - .../content/publication/clothing-search/index.md | 2 +- layouts/project/single.html | 12 +----------- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/archetypes/project/index.md b/archetypes/project/index.md index 4da13a56..09018675 100644 --- a/archetypes/project/index.md +++ b/archetypes/project/index.md @@ -25,7 +25,6 @@ external_link = "" url_pdf = "" url_code = "" url_dataset = "" -url_project = "" url_slides = "" url_video = "" url_poster = "" diff --git a/exampleSite/content/publication/clothing-search/index.md b/exampleSite/content/publication/clothing-search/index.md index 8d3857b2..8658028f 100644 --- a/exampleSite/content/publication/clothing-search/index.md +++ b/exampleSite/content/publication/clothing-search/index.md @@ -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 = "#" diff --git a/layouts/project/single.html b/layouts/project/single.html index cd40859f..fb5d3b28 100644 --- a/layouts/project/single.html +++ b/layouts/project/single.html @@ -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 }}

{{ (i18n "publications") }}

@@ -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 }}

{{ (i18n "talks") }}