Processing order

Don’t quite understand the processing order in Hugo. Does it convert markup to HTML first? I assume it has to, so it can apply layouts, etc. to HTML.

I’m not being facetious: what other thing does it have to process? If you explain your use case, we can probably let you know the order of whatever it is. :slight_smile:

Just want to confirm that it converts markup to the output (.md files or asciidoc) and passes through any HTML and Hugo shortcode tags to the same output, then applies layouts to the interim HTML. Another question, does it convert all of the content files first and then apply layouts, or does it pipeline each file?

We do all the rendering (i.e. content => HTML and “apply layouts”) in parallel. Which sounds like it would not work. But we render .Content on demand/lazily.

But note that it hasn’t always been that way, see https://gohugo.io/news/0.40-relnotes/

Before 0.40 we would first render all .Content then apply the layouts.

The problem with that approach, and which we got a lot of issue reports about, was that you couldn’t reliably access another page’s .Content (and the other content related variables) from a shortcode. Since that dependency graph is hard/impossible to predict, we “render on demand”.

2 Likes

Not an issue for me. Just wanted to know how it works. Rendering on demand makes sense.