HUGO

Partials based on content format

Is there something built in to determine content format?

Use case: use different partials depending on the content format, i.e. .md .org .html .adoc might receive slightly different treatments.

One way to achieve this would be to add a parameter to the front-matter, but I was wondering if there is already something available, or some template that might achieve this.

Output formats is what you are looking for: https://gohugo.io/templates/output-formats/#list-output-formats

edit:

I read too quickly. Have a look at .File variables: https://gohugo.io/variables/files/

1 Like

Thanks @pointyfar

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.