<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Template functions on Hugo</title><link>https://v0-122-0--gohugoio.netlify.app/functions/templates/</link><description>Recent content in Template functions on Hugo</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="https://v0-122-0--gohugoio.netlify.app/functions/templates/index.xml" rel="self" type="application/rss+xml"/><item><title>templates.Exists</title><link>https://v0-122-0--gohugoio.netlify.app/functions/templates/exists/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v0-122-0--gohugoio.netlify.app/functions/templates/exists/</guid><description>A template file is any file within the layouts directory of either the project or any of its theme components.
Use the templates.Exists function with dynamic template paths:
{{ $partialPath := printf &amp;#34;headers/%s.html&amp;#34; .Type }} {{ if templates.Exists ( printf &amp;#34;partials/%s&amp;#34; $partialPath ) }} {{ partial $partialPath . }} {{ else }} {{ partial &amp;#34;headers/default.html&amp;#34; . }} {{ end }} In the example above, if a &amp;ldquo;headers&amp;rdquo; partial does not exist for the given content type, Hugo falls back to a default template.</description></item></channel></rss>