Hugo noob, so sorry if this has been covered elsewhere. I’ve been searching the forums hoping to find a similar post, but my search fu is obviously failing.
So I’m understanding that content in markdown is separate from layout and can’t include partials for example, but has an escape hatch for doing dynamic stuff like the highlight shortcode which invokes pygment. Great so far.
My specific application is I’m trying to write documentation that specifically has HTML examples which must be rendered as HTML and also render the raw HTML using highlight. I can copy the markup twice and it does work, but this sort of defeats the dryness. Is there a way to create a short code that does both but loads it’s content from a single file?
e.g.
{{<example-html-and-highlight html "content="examples/example1.html"></example-html-and-highlight>}}
Currently I don’t think so. I think what you want is a Unix-cat like template function. This has been discussed in endless ways in the discussion about allowing execution of shell programs from Hugo templates. I think we should just add a cross-platform cat implementation before we land that discussion. I need it. Many people need it.