update related-post functionality, 404 page, and readme file

This commit is contained in:
somrat sorkar
2023-07-30 09:16:59 +06:00
parent 6a53b8d986
commit 90da619a5f
7 changed files with 77 additions and 64 deletions

View File

@@ -1,20 +1,24 @@
{{ define "main" }}
{{ with site.GetPage "404" }}
<section class="section-sm text-center">
<div class="container">
<div class="row justify-center">
<div class="sm:col-10 md:col-8 lg:col-6">
{{ partial "image" (dict "Src" .Params.image "Alt" .Title "Class" "mb-8") }}
<h1 class="h2 mb-4">{{ .Title }}</h1>
<div class="content">
{{ .Content }}
</div>
<a href="{{ site.BaseURL }}" class="btn btn-primary mt-8">
{{ i18n "back_to_home" }}
</a>
<section class="section-sm text-center">
<div class="container">
<div class="row justify-center">
<div class="sm:col-10 md:col-8 lg:col-6">
<span
class="text-[8rem] block font-bold text-dark dark:text-darkmode-dark"
>404</span
>
<h1 class="h2 mb-4">Page not found</h1>
<div class="content">
The page you are looking for might have been removed, had its name
changed, or is temporarily unavailable.
</div>
<a
href="{{ site.BaseURL | relLangURL }}"
class="btn btn-primary mt-8">
Back to home
</a>
</div>
</div>
</section>
{{ end }}
</div>
</section>
{{ end }}

View File

@@ -71,17 +71,20 @@
</div>
<!-- Related posts -->
<div class="section pb-0">
<h2 class="h3 mb-12">{{ i18n "related_posts" }}</h2>
<div class="row">
{{ $related := (where site.RegularPages "Section" "in" site.Params.mainSections) | intersect (where site.RegularPages ".Title" "!=" .Title) | union (site.RegularPages.Related . ) }}
{{ range first 3 $related }}
<div class="lg:col-4">
{{ partial "components/blog-card" . }}
</div>
{{ end }}
{{ $related := (where site.RegularPages "Section" "in" site.Params.mainSections) | intersect (where site.RegularPages ".Title" "!=" .Title) | union (site.RegularPages.Related . ) }}
{{ $related = $related | shuffle | first 3 }}
{{ with $related }}
<div class="section pb-0">
<h2 class="h3 mb-12">{{ i18n "related_posts" }}</h2>
<div class="row">
{{ range . }}
<div class="lg:col-4">
{{ partial "components/blog-card" . }}
</div>
{{ end }}
</div>
</div>
</div>
{{ end }}
</div>
</section>
{{ end }}