nychealth/EH-dataportal

Add conditional to image references

Closed this issue · 2 comments

Add a conditional statement, with a default image, to image references (index.html template, data stories section and single templates, and anything else relevant) so that when new content is created, if it doesn't have an image and image reference, builds will still complete.

Hey @cgettings, I started establishing a default image that gets overridden if .Params.image is specified, for data stories. That way we won't have build errors prior to adding an image. But, I'm running into an issue involving .Resize code. I think this only works if it's called on a Resource, rather than a string, and I'm having a hard time either doing that to a site-level resource (the default image), or converting strings to resources. I've tried unsuccessful things that I won't commit - using conditionals, with, Scratch, and other approaches to manage the logic but keep on running into one issue or another. I don't want to ditch use of Resize altogether, since it's especially important on the home page, key-topics, and data-stories section pages (where we're loading thumbnails). Not sure how to get this working though.

I'm going to close this and combine with #43 actually.