post.html

 1---
 2layout: default
 3---
 4
 5{% include post/title.html %}
 6<div class="content">
 7    {{ content }}
 8</div>
 9<script>
10document.querySelectorAll('.content h1, .content h2, .content h3').forEach($heading => {
11
12  // get id from headings
13  var id = $heading.getAttribute("id") || $heading.innerText.toLowerCase().replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, '').replace(/ +/g, '-');
14
15  // create anchors for id
16  $anchor = document.createElement('a');
17  $anchor.className = "headerlink";
18  $anchor.href = '#' + id;
19
20  // prepend anchor to heading text
21  $heading.prepend($anchor);
22});
23</script>
24{% include post/about.html %}
25<br/>
26<br/>
27<img class="post-image" src="{{ page.cover }}">