Skip to content
This repository was archived by the owner on Feb 1, 2023. It is now read-only.

Commit c0faacd

Browse files
committed
Guard against Markdown titles
1 parent 8b231b0 commit c0faacd

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

_layouts/page.html

+7-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@
77
{% include page-image.html %}
88
<div class="page-wrapper">
99
<header class="page-header">
10+
{% if page.id %}
11+
{% assign title = page.title | markdownify | strip_html %}
12+
{% else %}
13+
{% assign title = page.title %}
14+
{% endif %}
1015
{% if page.link %}
11-
<h1 id="page-title" class="page-title"><a href="{{ page.link }}">{{ page.title }} <span class="link-arrow">&rarr;</span></a></h1>
16+
<h1 id="page-title" class="page-title"><a href="{{ page.link }}">{{ title }} <span class="link-arrow">&rarr;</span></a></h1>
1217
{% else %}
13-
<h1 id="page-title" class="page-title">{{ page.title }}</h1>
18+
<h1 id="page-title" class="page-title">{{ title }}</h1>
1419
{% endif %}
1520
</header>
1621
<div class="page-content">

example/_posts/2013-01-05-markup-title-with-markup.md example/_posts/2013-01-05-markup-title-with-markdown.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ Using Markdown in the title should have no adverse effect on the layout or funct
1515

1616
```yaml
1717
title: "Markup: Title *with* **Markdown**""
18-
```
18+
```

0 commit comments

Comments
 (0)