keimena/layouts/partials/post.html

61 lines
2.1 KiB
HTML
Raw Normal View History

2024-05-27 21:13:51 +00:00
<div class="post container">
<div class="post-header-section">
<h1>{{ .Title }}</h1>
2024-06-21 23:17:17 +00:00
<small role="doc-subtitle" class="chapter-title">{{ .Description }}</small>
2024-05-27 21:13:51 +00:00
</div>
<div class="post-content">
{{ .Content }}
</div>
<div class="prev-next">
{{ if eq .Site.Params.TogglePreviousAndNextButtons "true" }}
{{ if or .PrevInSection .NextInSection }}
{{ partial "prev-next.html" . }}
{{ end }}
{{ end }}
</div>
<!-- Back to top button -->
{{ if .Site.Params.ShowBackToTopButton }}
<svg id="btt-button" class="arrow-logo" xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 384 512" onclick="topFunction()" title="Go to top">
<!-- Your arrow SVG path or elements go here -->
<path d="M177 159.7l136 136c9.4 9.4 9.4 24.6 0 33.9l-22.6 22.6c-9.4 9.4-24.6 9.4-33.9 0L160 255.9l-96.4 96.4c-9.4 9.4-24.6 9.4-33.9 0L7 329.7c-9.4-9.4-9.4-24.6 0-33.9l136-136c9.4-9.5 24.6-9.5 34-.1z"/>
</svg>
<script>
let backToTopButton = document.getElementById("btt-button");
window.onscroll = function() {
scrollFunction()
};
function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
backToTopButton.style.display = "block";
} else {
backToTopButton.style.display = "none";
}
}
function topFunction() {
smoothScrollToTop();
}
function smoothScrollToTop() {
const scrollToTop = () => {
const c = document.documentElement.scrollTop || document.body.scrollTop;
if (c > 0) {
window.requestAnimationFrame(scrollToTop);
window.scrollTo(0, c - c / 8);
}
};
scrollToTop();
}
</script>
{{ end }}
{{ if .Site.Params.CustomCommentHTML }}
<div id="comments">
{{ .Site.Params.CustomCommentHTML | safeHTML }}
</div>
{{ end }}
</div>