Search code examples
jekyll

How to add a line break to a post title?


---
layout: post
title: Markdown:<br>Style Guide
---

I expect this to produce

<h1>Markdown:<br>
Style Guide</h1>

But there are two issues. The colon breaks the Yaml. Hence I need to put " " around it.

---
layout: post
title: "Markdown:<br>Style Guide"
---

But what I can't solve is the line break in the title. It displays <br> instead of actually breaking the line. Is there any way?


Solution

  • You probably use a default Jekyll template which uses {{ post.title | escape }}.

    If you remove the escape filter, all your html will be preserved.

    It now reads : {{ post.title }} or {{ page.title }} depending on the context.