Access content fragments in templates

Hello Hugoers,
I hope you are all doing well!
I am trying to do some advanced design on some of my pages.
For instance, I want to put some text and images in special divs here and there, etc.
For this, the solution I found is to use specific templates:


The content of the markdown is basically only the front matter (title and menu infos).
All the design is done in the html file.
I wonder if I could use some parts of the markdown content in the HTML? Something like: {{.Content.chapter1}}
Or some other way to access the details of the content from the markdown…

An example of usage is a page with a list of videos. How could I list the videos in the markdown, and display them in a row/collumn design with players?

There’s no easy solution for what you want to achieve I’m afraid. But you have two regex functions in Hugo that may help you

Those used on .RawContent (your page’s raw Markdown] might allow you to find those videos, remove them from the content, and use them somewhere else…


Thanks, findRE and replaceRE looks good.
I see that a custom shortcode could also be used…

Is it also possible to use the frontmatter yaml format to list the videos?
Or any JSON file…

Edit: nevermind, I found data templates: