Hi! I’m working on my first Hugo template. I have created a search partial, which depends on whether the user enables JSON output in the site config.
config.toml:
[outputs]
home = [ "HTML", "JSON"]
page = [ "HTML"]
The logic in the partial should be, “if JSON is among the home output types, add the following HTML”. (Because that is a prerequisite.)
I tried the in
function, but I’m sure I’m doing something wrong. Here is what I tried:
{{ if in .Site.outputs.home "json" }}
<!-- Html Elements for Search -->
<div id="search-container">
</div>
<!-- Script pointing to search-script.js -->
<script src="/js/search-script.min.js" type="text/javascript"></script>
<!-- Configuration -->
<script>
</script>
{{ end }}
Please point me in the right direction. Here is my repository.