I wanted to display meta tag only for a specific page type. I referenced Hugo Docs and there’s a variable called .Type which can tell you the page type according to the folders in the content directory.
However, the following code gives me error:
{{ if eq .Type "essays" }}
<meta name="twitter:creator" content="@{{ . }}"/>
{{ end }}
Error: Error building site: failed to render pages: render of "page" failed: execute of template failed: template: _default/single.html:5:8: executing "_default/single.html" at <partial "head.html" .>: error calling partial: execute of template failed: template: partials/templates/twitter_cards.html:33:9: executing "partials/templates/twitter_cards.html" at <.Type>: can't evaluate field Type in type string
I am new to Hugo. Any help would be highly appreciated.