(Photo by June Wong on Unsplash)
Demo: https://hello-zola.netlify.app/
Repo: https://github.com/davidedelpapa/zola-helloworld
Zola (by Vincent P...
For further actions, you may consider blocking this person and/or reporting abuse
I realize this post is a bit old, but I have a question that is outside it's original scope anyway...hoping you can help or point me in the right direction.
I would like to have a "shortcode" that generates an image gallery with a caption under each image. I have figured out the html and css side of things, but I can't figure out how to pass data into the shortcode for this. I suspect this is becuase I am ignorant of Rust, but the Rust documentation didn't help me.
I was hoping I could have some kind of data in the [extra] block of the page that simple contains the image file name and the text of the caption. Then, I would call my gallery() shortcode somewhere in the page and it would plug the data in at the right places...iterating through each image file name/caption combo.
Typically I would use an object for this in something like JavaScript or Ruby but Rust doesn't seem to work that way since it is a lower level language. Any thoughts?
My reply is unfortunately quite late. You can do this in multiple ways. Either have a file, that contains captions and paths (JSON, YAML …), somehwere in your project that can be read with
load_data(see zola docs) or define an array with links to files and captions as an argument for the shortcode (see the Tera docs (used template engine) and the Zola docs for more details)Better late than never! Thanks. I will give those suggestions a try. I moved on to other projects...but I should get back to this one about now!
I try it to day and after (1st Page) creating index.md in content , I get
Error: Failed to serve the site
Error: We can't have a page called
index.mdin the same folder as an index section in "........../zola-helloworld/content"Renaming index.md to _index.md solve the problem but then I get :
Error: Failed to serve the site
Error: Failed to render section '............/zola-helloworld/content/_index.md'
Error: Reason: Failed to render 'base.html'
Error: Reason: Variable
page.titlenot found in context while rendering 'base.html'All done with copy/paste from this site
If I remove page.site from base.html then I have page.content not found
Any idea ??
Which version of Zola are you using? It seems there was a bug in version 0.17