title: Hugo: do not escape HTML in a page .Title when generating <title> tag in the header.html partial
body: <p>In my Hugo-based website, I often use <code>&lt;span&gt;</code> tags within my post titles. I am experiencing an issue where this HTML is always escaped in one particular context. As an example, take a post where the title given in the header of the Markdown file is as follows:</p>
  <pre><code>title: 'This is a title with Spanish: &lt;span lang=&quot;es&quot;&gt;Hola!&lt;/span&gt;'
  </code></pre>
  <p>In the single.html partial of my Hugo theme, <code>&lt;h2 class=&quot;posttitle&quot;&gt;{{ .Title | markdownify }}&lt;/h2&gt;</code> works correctly, it passes <code>This is a title with Spanish: &lt;span lang=&quot;es&quot;&gt;Hola!&lt;/span&gt;</code> to the final HTML of the page.</p>
  <p>However, in the header.html partial of my Hugo theme, <code>&lt;title&gt;{{ .Title | markdownify }}&lt;/title&gt;</code> does <strong>not</strong> work. Instead, Hugo passes an escaped string to the final HTML of the page: <code>&lt;title&gt;This is title with Spanish: &amp;lt;span lang=&amp;#34;es&amp;#34;&amp;gt;Hola!&amp;lt;/span&amp;gt;&lt;/title&gt;</code></p>
  <p>How can I achieve the same behavior in header.html as in single.html?</p>
  <p><strong>EDIT</strong>: My theme is exceedingly simple, the hugo-xmin theme with minimal changes. My theme’s header.html partial is as follows:</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang=&quot;{{ .Site.LanguageCode }}&quot;&gt;
    &lt;head&gt;
      &lt;meta charset=&quot;utf-8&quot;&gt;
      &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;
      &lt;title&gt;{{ .Title | markdownify }} &amp;#124; {{ .Site.Title }}&lt;/title&gt;
      &lt;link rel=&quot;stylesheet&quot; media=&quot;screen&quot; href=&quot;{{ &quot;/css/style.css&quot; | relURL }}&quot; /&gt;
      &lt;link rel=&quot;stylesheet&quot; media=&quot;screen&quot; href=&quot;{{ &quot;/css/screen.css&quot; | relURL }}&quot; /&gt;
      {{ partial &quot;head_custom.html&quot; . }}
    &lt;/head&gt;
    &lt;body&gt;
      &lt;h1 id=&quot;sitetitle&quot;&gt;.Site.Title&lt;/h1&gt;
      &lt;p id=&quot;sitedescription&quot;&gt;{{ $.Site.Params.description }}&lt;/p&gt;
      &lt;nav&gt;
      &lt;ul class=&quot;menu&quot;&gt;
        {{ range .Site.Menus.main }}
        &lt;li&gt;&lt;a href=&quot;{{ .URL | relURL }}&quot;&gt;{{ .Name }}&lt;/a&gt;&lt;/li&gt;
        {{ end }}
      &lt;/ul&gt;
      &lt;hr/&gt;
      &lt;/nav&gt;
  </code></pre>
  <p>and my theme’s single.html file is as follows:</p>
  <pre><code>{{ partial &quot;header.html&quot; . }}
  &lt;main&gt;
  &lt;div class=&quot;article-meta&quot;&gt;
  &lt;h2 class=&quot;posttitle&quot;&gt;{{ .Title | markdownify }}&lt;/h2&gt;
  Published on &lt;a href=&quot;{{ .RelPermalink }}&quot;&gt;&lt;time&gt;{{ .Date.Format &quot;2006-01-02&quot; }}&lt;/time&gt;&lt;/a&gt;
  &lt;/div&gt;
  {{ .Content }}
  &lt;/main&gt;
  
  {{ partial &quot;footer.html&quot; . }}
  </code></pre>