-
Notifications
You must be signed in to change notification settings - Fork 7
Description
A blog file specifies a hero image in its header:
heroImageThumb: blog-thumb.jpg # size: 300x300 jpg format |
A news file does not:
www-main/content/about/news/headless/2016_12.md
Lines 2 to 4 in 1287604
date: 2016-12-01 | |
title: Delphi Wins 2015-2016 Forecasting Challenge | |
category: accomplishment |
This means that when the landing page formulates its "latest news" section, it can grab a unique thumbnail image for each recent blog post, but is stuck with the placeholder-thumb "D" logo for each recent news item:
via
www-main/themes/delphi/layouts/partials/landing/latest-news.html
Lines 4 to 12 in 1287604
{{ define "partials/latest-blog" }} | |
{{ return (dict "source" "blog" "img" (($.GetPage "/blog/images").Resources.GetMatch .Params.heroImageThumb) "title" .Title "link" .RelPermalink "date" .PublishDate "summary" "" ) }} | |
{{ end }} | |
{{ $items := apply (.Site.GetPage "/blog").Pages "partial" "latest-blog" "." }} | |
{{ define "partials/latest-news-item" }} | |
{{ return (dict "source" "news" "img" (resources.Get "/images/placeholder-thumb.jpg") "title" .Title "date" .PublishDate "link" (.Site.GetPage "/about/news").RelPermalink "summary" (.Summary | safeHTML | truncate 100) ) }} | |
{{ end }} | |
{{ $newsItems := apply ((.Site.GetPage "/about/news/headless").Resources.ByType "page") "partial" "latest-news-item" "." }} |
To make it so that the "latest news" section on the landing page can display a more useful thumbnail for news items, we need to:
- Pick a new parameter name for news item thumbnail images
- Add this parameter to all existing news item pages (possibly just pointing to the placeholder-thumb)
- Upload thumbnails for all existing news items not specifying the placeholder-thumb
- Update the latest-news template with something like
($.GetPage "/blog/images").Resources.GetMatch .Params.heroImageThumb
instead ofresources.Get "/images/placeholder-thumb.jpg"
- See if it works & fix it until it does
If we additionally want to display the thumbnail on the news listing page (https://delphi.cmu.edu/about/news/), we'd need to update the news item template, possibly based on the blog card template. This would however be more complicated and we might need to pull in sam.