I’m relatively new to Hugo so apologies if I’m using the vocabulary wrong.
Is there a way to take a string and render it to the page as a template using a supplied context? Let’s say I have a YAML file that is structured like the following:
I have a bunch of data that needs to be laid out similarly but have pieces of it composed differently that I’d like to dynamically define via YAML. Perhaps I’m approaching this the wrong way though.
I did try to use this but was unable to make it work. As far as I can tell it wants to create a resource file and needs a target path.
I’m also not sure if markdown will achieve my goals. I’m not looking for just dynamic formatting but also being able to dynamically control the structure of the data in my front matter.
But to be fair this is also probably the wrong place to be doing it.
My website is a resume (cloud resume challenge). I’m wanting to generate the static files with Hugo. My resume is compromised of sections like Education and Work Experience.
Each section is compromised of entries which are basically just a title and then a bulleted list of highlights for that entry.
Education
University1 - City, State
Degree
Cool project1
Cool project2
University2 - City, State
Degree
Cool project1
Cool project2
Experience
Job1 - Job Title
Cool project1
Cool project2
Job2 - Job Title
Cool project1
Cool project2
I was splitting each section into its own YAML file: education.yaml, experience.yaml, etc… And then using partials to render them. I got a wild hair to try and use a single partial to render all the sections. And let the YAML files dictate how the info in the section is made up. I could do that by just having the YAML files structured like:
entry:
- title: University1 - City, State
highlights:
- Cool Project1
- Cool Project2
but I liked the idea of the files being more readable and using a field to help guide the partial on how that data is pieced together.
But it does seem like perhaps the philosophy here is to keep the logic out of the data files. Which makes sense.
I think a general good practice is to separate UI logic from data.
It creates a resource object, but the file will only be published once you access .RelPermalink etc. You can still treat it as an inline “thing” by calling .Content on the resource.