Closed neilhwatson closed 7 years ago
Ah! You fell into my trap! https://github.com/preaction/Statocles/issues/436
TL;DR: The "images" key is not like the "links" key, it does not yet allow an array of images. That could be fixed by making it work more like the links key (so, copy/pasting behaviors over).
I think I only need a generic way to declare data in markdown and process it in a template.
Actually using data: works.
---
title: Winter at The Waves
template: gallery/index.html
data:
gallery:
- src: /static/images/winter/winter-view.jpg
caption: Lake ice in the winter
- src: /static/images/winter/snowy-owl.jpg
caption: Winter birds include Snowy Owls
---
% for my $i ( @{ $page->data->{gallery} } ){
<img src="<%= $i->{src} %>" data-caption="<%= $i->{caption} %>" >
% }
Yes, that's what data
is best used for. The images
and links
keys are mostly for theme authors to add ways to customize things that aren't in the main content below (like, a "title" image that could be shown on the blog list page, or metadata images that show up on twitter and facebook #504 ).
So, should we close this one in favor of #436?
Consider this template:
Results in: