109 lines
4.2 KiB
HTML
109 lines
4.2 KiB
HTML
{{ define "main" }}
|
|
<section class="bg-cover items-center pt-32 pb-32 ">
|
|
<div class="container">
|
|
<div class="row justify-center">
|
|
<article class="lg:col-10">
|
|
{{ $image:= .Params.image }}
|
|
{{ if $image }}
|
|
<div class="mb-10">
|
|
{{ partial "image" (dict "Src" $image "Alt" .Title "Class" "w-full rounded") }}
|
|
</div>
|
|
{{ end }}
|
|
<h1 class="h2 mb-4">
|
|
{{ .Title }}
|
|
</h1>
|
|
<ul class="mb-4">
|
|
<li class="mr-4 inline-block">
|
|
<a
|
|
href="{{ `authors/` | relLangURL }}{{ .Params.Author | urlize }}/">
|
|
<i class="fa-regular fa-circle-user mr-2"></i
|
|
>{{ .Params.author }}
|
|
</a>
|
|
</li>
|
|
{{ $categories:= .Params.categories }}
|
|
{{ if $categories }}
|
|
<li class="mr-4 inline-block">
|
|
<i class="fa-regular fa-folder mr-2"></i>
|
|
{{ range $i,$p:= $categories }}
|
|
<a
|
|
href="{{ `categories/` | relLangURL }}{{ . | urlize | lower }}/"
|
|
class=""
|
|
>{{ . | humanize }}{{ if ne $i (sub (len $categories) 1) }}
|
|
{{ "," }}
|
|
{{ end }}
|
|
</a>
|
|
{{ end }}
|
|
</li>
|
|
{{ end }}
|
|
<li class="mr-4 inline-block">
|
|
<i class="fa-regular fa-clock mr-2"></i>
|
|
{{ time.Format ":date_long" .PublishDate }}
|
|
</li>
|
|
</ul>
|
|
<div class="content mb-10">
|
|
{{ .Content }}
|
|
</div>
|
|
<div class="row items-start justify-between">
|
|
{{ $tags:= .Params.tags }}
|
|
{{ if $tags }}
|
|
<div class="lg:col-5 mb-10 flex items-center lg:mb-0">
|
|
<h5 class="mr-3">{{ i18n "tags" }} :</h5>
|
|
<ul>
|
|
{{ range $i,$p:= $tags }}
|
|
<li class="inline-block">
|
|
<a
|
|
class="bg-theme-light hover:bg-primary m-1 block rounded px-3 py-1 hover:text-white"
|
|
href="{{ `tags/` | relLangURL }}{{ . | urlize | lower }}/">
|
|
{{ . | humanize }}
|
|
</a>
|
|
</li>
|
|
{{ end }}
|
|
</ul>
|
|
</div>
|
|
{{ end }}
|
|
</article>
|
|
</div>
|
|
<!-- Related posts -->
|
|
<div id="accordion" class="divide-y divide-gray-200">
|
|
{{ $currentPage := . }}
|
|
|
|
{{ range first 3 (where .Site.RegularPages "Section" $currentPage.Section) }}
|
|
{{ if ne .RelPermalink $currentPage.RelPermalink }}
|
|
<div class="accordion-item">
|
|
<h2 class="accordion-header mb-0" style="padding:0!important;">
|
|
<button class="accordion-button relative flex items-center w-full py-4 px-5 text-left text-gray-800 bg-gray-100 focus:outline-none" type="button">
|
|
<i class="far text-primary fa-bullhorn"></i> {{ .Title }}
|
|
</button>
|
|
</h2>
|
|
<div class="accordion-collapse hidden">
|
|
<div class="accordion-body py-4 px-5">
|
|
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{ end }}
|
|
{{ end }}
|
|
</div>
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
const accordionButtons = document.querySelectorAll('.accordion-button');
|
|
|
|
accordionButtons.forEach(button => {
|
|
button.addEventListener('click', () => {
|
|
const accordionCollapse = button.parentElement.nextElementSibling;
|
|
|
|
button.classList.toggle('active');
|
|
if (button.classList.contains('active')) {
|
|
button.parentElement.nextElementSibling.classList.remove('hidden');
|
|
accordionCollapse.style.maxHeight = accordionCollapse.scrollHeight + 'px';
|
|
} else {
|
|
accordionCollapse.style.maxHeight = null;
|
|
button.parentElement.nextElementSibling.classList.add('hidden');
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
</div>
|
|
</section>
|
|
{{ end }}
|