NixNet/_layouts/post.html

28 lines
684 B
HTML

---
layout: default
---
{% include post/title.html %}
<div class="content">
{{ content }}
</div>
<script>
document.querySelectorAll('.content h1, .content h2, .content h3').forEach($heading => {
// get id from headings
var id = $heading.getAttribute("id") || $heading.innerText.toLowerCase().replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, '').replace(/ +/g, '-');
// create anchors for id
$anchor = document.createElement('a');
$anchor.className = "headerlink";
$anchor.href = '#' + id;
// prepend anchor to heading text
$heading.prepend($anchor);
});
</script>
{% include post/about.html %}
<br/>
<br/>
<img class="post-image" src="{{ page.cover }}">