I’m trying to convert my blog from Jekyll to Hugo. In Jekyll inside the Front Matter I had a decently large user data section that I defined.
I would then include a template of an SVG from the Jekyll _includes folder that would use the data in my page. In Jekyll it seems the _includes are also templates where as in Hugo under the static page they cannot be templatized.
How do I do this in Hugo?
My basic requirements are:
- Create a Blog Post
- Define Data Somewhere
- Use the data to templatize an SVG
- Include the SVG in the Post using a figure shortcode.
I have learned the hard way to NOT include the SVG but use the figure shortcode. Any help would be much appreciated.
Here is the structure of the Jekyll.
My Jekyll Blog Post:
---
layout: post
title: Some Title
date: 2020-03-25
comments: true
categories: unix
mydata:
- something
- another something
---
{% include svg/a-template-svg.svg %}
Now inside my SVG in the Jekyll _includes folder I have:
<svg width="640" height="10000" viewBox="0 0 640 10000" xmlns="http://www.w3.org/2000/svg">
{% for i in mydata %}
<rect ....></rect>
{% endfor %}
</svg>