Add URL fragments in build time

This commit is contained in:
Vojtěch Káně
2021-06-01 17:33:59 +02:00
parent c0f87fe601
commit 56843f347a
2 changed files with 1 additions and 7 deletions

View File

@@ -36,10 +36,4 @@ const toggleToc = () => {
if (header !== null) {
listen('#menu-btn', "click", toggleMobileMenu);
listen('#toc-btn', "click", toggleToc);
document.querySelectorAll('.post-year').forEach((ele)=> {
ele.addEventListener('click', () => {
window.location.hash = '#' + ele.id;
});
});
}

View File

@@ -12,7 +12,7 @@
{{- end }}
{{- range .Data.Pages.GroupByDate "2006" }}
<div class="posts-group">
<div class="post-year" id="{{ .Key }}">{{ .Key }}</div>
<div class="post-year"><a href="#{{ .Key }}">{{ .Key }}</a></div>
<ul class="posts-list">
{{- range .Pages }}
<li class="post-item">