Update: blogs folder/url/breadcrumb restructure

This commit is contained in:
hyzen
2026-07-26 22:13:40 +05:30
parent 1117a46f12
commit cac5039220
27 changed files with 160 additions and 162 deletions

View File

@@ -1,39 +1,35 @@
{{ define "main" }}
{{ $sectionPagerSize := or site.Params.sectionPagerSize 10 }}
{{ $paginator := .Paginate .Pages.ByDate.Reverse $sectionPagerSize }}
{{ define "main" }} {{ $sectionPagerSize := or site.Params.sectionPagerSize 10 }} {{ $paginator :=
.Paginate .Pages.ByDate.Reverse $sectionPagerSize }}
<nav class="uninotes-breadcrumbs breadcrumbs">
<a href="/blog/">Blog</a>
<a href="/categories/">Categories</a>
<span>{{ .Title }}</span>
{{ if gt $paginator.TotalPages 1 }}
<span>Page {{ $paginator.PageNumber }} of {{ $paginator.TotalPages }}</span>
{{ end }}
<a href="/blog/">Blog</a>
<a href="/blog/categories/">Categories</a> <span>{{ .Title }}</span> {{ if gt
$paginator.TotalPages 1 }}
<span>Page {{ $paginator.PageNumber }} of {{ $paginator.TotalPages }}</span>
{{ end }}
</nav>
{{ .Content }}
<h1>
<a href="/blog/" style="text-decoration: none; color: var(--accent-color);">All Posts</a> |
<a href="/categories/" style="text-decoration: none; color: var(--accent-color);">Categories</a>
<a href="/blog/" style="text-decoration: none; color: var(--accent-color)">All Posts</a> |
<a href="/blog/categories/" style="text-decoration: none; color: var(--accent-color)"
>Categories</a
>
</h1>
<h2>{{ .Title }}</h2>
<div style="margin-bottom: 2rem;"></div>
<div style="margin-bottom: 2rem"></div>
<section class="posts-list">
{{ range $paginator.Pages }}
{{ partial "main/dates.html" . }}
<h2 class="term-post-title">
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
</h2>
{{ end }}
{{ range $paginator.Pages }} {{ partial "main/dates.html" . }}
<h2 class="term-post-title">
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
</h2>
{{ end }}
</section>
<nav class="paginator">
{{- partial "pagination.html" . }}
</nav>
<nav class="paginator">{{- partial "pagination.html" . }}</nav>
{{ end }}

View File

@@ -2,14 +2,31 @@
<nav class="uninotes-breadcrumbs breadcrumbs">
<a href="/blog/">Blog</a>
<span>{{ .Title }}</span>
{{ with .GetTerms "categories" }}{{ range first 1 . }}
<a href="/blog/categories/">Categories</a>
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a> {{ end }}{{ end }}
<span>{{ .Title }}</span>
</nav>
<h1>{{ .Title }}</h1>
{{ partial "page/author.html" . }} {{ partial "main/dates.html" . }} {{ partial
"page/translation_list.html" . }} {{ partial "page/toc.html" . }} {{ .Content }} {{ partial
"page/terms.html" (dict "taxonomy" "tags" "page" .) }} {{ partial "page/terms.html" (dict "taxonomy"
"categories" "page" .) }} {{ partial "page/page_nav.html" . }} {{ partial "page/page-end.html" . }}
"categories" "page" .) }} {{ $blogPosts := (where site.RegularPages "Section" "blog").ByDate.Reverse
}} {{ $currentPermalink := .RelPermalink }} {{ $currentIndex := 0 }} {{ range $index, $post :=
$blogPosts }}{{ if eq $post.RelPermalink $currentPermalink }}{{ $currentIndex = $index }}{{ end }}{{
end }} {{ if gt (len $blogPosts) 1 }}
<nav class="page-nav">
{{ if gt $currentIndex 0 }}{{ $previous := index $blogPosts (sub $currentIndex 1) }}
<a class="page-nav__previous-link" href="{{ $previous.RelPermalink }}"
>← {{ $previous.LinkTitle }}</a
>
{{ end }} {{ if lt $currentIndex (sub (len $blogPosts) 1) }}{{ $next := index $blogPosts (add
$currentIndex 1) }}
<a class="page-nav__next-link" href="{{ $next.RelPermalink }}">{{ $next.LinkTitle }} →</a>
{{ end }}
</nav>
{{ end }} {{ partial "page/page-end.html" . }}
<!-- ── Comments ── -->
<section class="comments" id="comments">
@@ -20,7 +37,7 @@
<script>
(function () {
var BACKEND = 'https://backend.freedoms4.org/comments.php';
var POST_ID = {{ .RelPermalink | jsonify | safeJS }};
var POST_ID = {{ printf "/blog/%s/" (.File.ContentBaseName | urlize) | jsonify | safeJS }};
var username = localStorage.getItem('f4_username');
var isAdmin = false;

View File

@@ -1,29 +1,26 @@
{{ define "main" }}
{{ $pages := .Pages }}
{{ $sectionPagerSize := or site.Params.sectionPagerSize 10 }}
{{ $paginator := .Paginate $pages $sectionPagerSize }}
{{ define "main" }} {{ $pages := .RegularPages }} {{ if eq .Section "blog" }}{{ $pages =
.RegularPagesRecursive }}{{ end }} {{ $sectionPagerSize := or site.Params.sectionPagerSize 10 }} {{
$paginator := .Paginate $pages $sectionPagerSize }}
<nav class="uninotes-breadcrumbs breadcrumbs">
<a href="/blog/">Blog</a>
{{ if gt $paginator.TotalPages 1 }}
<span>Page {{ $paginator.PageNumber }} of {{ $paginator.TotalPages }}</span>
{{ end }}
<a href="/blog/">Blog</a>
{{ if gt $paginator.TotalPages 1 }}
<span>Page {{ $paginator.PageNumber }} of {{ $paginator.TotalPages }}</span>
{{ end }}
</nav>
{{ .Content }}
<h1>All Posts | <a href="/categories/" style="text-decoration: none; color: var(--accent-color);">Categories</a></h1>
{{ range $paginator.Pages }}
<h2 class="home-post-title"><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ partial "main/dates.html" . }}
{{ with .Summary }}
{{- /*
Create deterministic summary output for styling.
See https://github.com/gohugoio/hugo/issues/8910
*/ -}}
<p class="summary">{{ . | plainify | htmlUnescape | chomp | truncate 150 }}</p>
{{- end }}
{{ end }}
<nav class="paginator">
{{- partial "pagination.html" . }} {{/* embedded template */}}
</nav>
{{ .Content }}
<h1>
All Posts |
<a href="/blog/categories/" style="text-decoration: none; color: var(--accent-color)"
>Categories</a
>
</h1>
{{ range $paginator.Pages }}
<h2 class="home-post-title"><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
{{ partial "main/dates.html" . }} {{ with .Summary }} {{- /* Create deterministic summary output for
styling. See https://github.com/gohugoio/hugo/issues/8910 */ -}}
<p class="summary">{{ . | plainify | htmlUnescape | chomp | truncate 150 }}</p>
{{- end }} {{ end }}
<nav class="paginator">{{- partial "pagination.html" . }} {{/* embedded template */}}</nav>
{{ end }}