Skip to content

Commit b715177

Browse files
authored
Correctly slugify distill TOC (alshedivat#519)
* Correctly slugify distill TOC * Add special character to demo distill post's TOC
1 parent 17329fc commit b715177

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

_layouts/distill.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ <h1>{{ page.title }}</h1>
7373
<nav class="l-text figcaption">
7474
<h3>Contents</h3>
7575
{% for section in page.toc -%}
76-
<div><a href="#{{ section.name | downcase | replace: ' ','-' }}">{{ section.name }}</a></div>
76+
<div><a href="#{{ section.name | slugify }}">{{ section.name }}</a></div>
7777
{% if section.subsections -%}
7878
<ul>
7979
{% for subsection in section.subsections -%}
80-
<li><a href="#{{ subsection.name | downcase | replace: ' ','-' }}">{{ subsection.name }}</a></li>
80+
<li><a href="#{{ subsection.name | slugify }}">{{ subsection.name }}</a></li>
8181
{% endfor %}
8282
</ul>
8383
{%- endif -%}

_posts/2018-12-22-distill.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ toc:
3636
- name: Footnotes
3737
- name: Code Blocks
3838
- name: Layouts
39-
- name: Other Typography
39+
- name: Other Typography?
4040

4141
# Below is an example of injecting additional post-specific styles.
4242
# If you use this post as a template, delete this _styles block.
@@ -173,7 +173,7 @@ It does not interrupt the normal flow of `.l-body` sized text except on mobile s
173173

174174
***
175175

176-
## Other Typography
176+
## Other Typography?
177177

178178
Emphasis, aka italics, with *asterisks* (`*asterisks*`) or _underscores_ (`_underscores_`).
179179

@@ -279,4 +279,4 @@ Here's a line for us to start with.
279279
This line is separated from the one above by two newlines, so it will be a *separate paragraph*.
280280

281281
This line is also a separate paragraph, but...
282-
This line is only separated by a single newline, so it's a separate line in the *same paragraph*.
282+
This line is only separated by a single newline, so it's a separate line in the *same paragraph*.

0 commit comments

Comments
 (0)