Skip to content

Consider adding thumbnail images for news items #524

@krivard

Description

@krivard

A blog file specifies a hero image in its header:

heroImageThumb: blog-thumb.jpg # size: 300x300 jpg format

A news file does not:

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:

image

via

{{ 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:

  1. Pick a new parameter name for news item thumbnail images
  2. Add this parameter to all existing news item pages (possibly just pointing to the placeholder-thumb)
  3. Upload thumbnails for all existing news items not specifying the placeholder-thumb
  4. Update the latest-news template with something like ($.GetPage "/blog/images").Resources.GetMatch .Params.heroImageThumb instead of resources.Get "/images/placeholder-thumb.jpg"
  5. 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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions