Fix: date in services

This commit is contained in:
hyzen
2026-04-09 02:41:03 +05:30
parent fc6125a69a
commit 426c3f2f60
56 changed files with 776 additions and 825 deletions

View File

@@ -0,0 +1,18 @@
{{ define "main" }}
<nav class="uninotes-breadcrumbs breadcrumbs">
<a href="/blog/">Blog</a>
<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" . }}
{{ end }}

View File

@@ -1,15 +1,30 @@
{{ 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 }}
</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></h1>
<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>
</h1>
<h2>{{ .Title }}</h2>
<div style="margin-bottom: 2rem;"></div>
<section class="posts-list">
{{ range .Pages.ByDate.Reverse }}
{{ range $paginator.Pages }}
{{ partial "main/dates.html" . }}
<h2 class="term-post-title">
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
@@ -17,4 +32,8 @@
{{ end }}
</section>
<nav class="paginator">
{{- partial "pagination.html" . }}
</nav>
{{ end }}

View File

@@ -2,6 +2,14 @@
{{ $pages := .Pages }}
{{ $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 }}
</nav>
{{ .Content }}
<h1>All Posts | <a href="/categories/" style="text-decoration: none; color: var(--accent-color);">Categories</a></h1>
{{ range $paginator.Pages }}

View File

@@ -0,0 +1,65 @@
<!doctype html>
<html
class="html"
lang="{{ or site.Language.LanguageCode site.Language.Lang }}"
dir="{{ or site.Language.LanguageDirection `ltr` }}"
>
<head>
{{ partial "head.html" . }}
</head>
<body class="body">
<header class="header">
<div class="brand">
<img src="/logo.png" alt="Freedoms4 logo" />
<h1>Freedoms4</h1>
<div class="brand__actions">
<button class="theme-toggle" id="theme-toggle" aria-label="Toggle theme" title="Toggle dark/light mode">
<svg class="theme-toggle__sun" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><path d="M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41l-1.06-1.06zm1.06-12.37l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06c.39-.39.39-1.03 0-1.41s-1.03-.39-1.41 0zM7.05 18.36l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06c.39-.39.39-1.03 0-1.41s-1.03-.39-1.41 0z"/></svg>
<svg class="theme-toggle__moon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><path d="M21 12.79A9 9 0 1 1 11.21 3a7 7 0 0 0 9.79 9.79z"/></svg>
</button>
<!-- Desktop: account + subscribe -->
<div class="brand__auth brand__auth--desktop">
<input type="checkbox" id="auth-dropdown" class="brand__auth-check" />
<label class="brand__auth-toggle" for="auth-dropdown" tabindex="0" aria-label="Account options">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="12" height="12" fill="currentColor"><path d="M12 12c2.7 0 4.8-2.1 4.8-4.8S14.7 2.4 12 2.4 7.2 4.5 7.2 7.2 9.3 12 12 12zm0 2.4c-3.2 0-9.6 1.6-9.6 4.8v2.4h19.2v-2.4c0-3.2-6.4-4.8-9.6-4.8z"/></svg>
</label>
<div class="brand__auth-links">
<a href="/login/" class="auth-link auth-link--login">Login</a>
<a href="/signup/" class="auth-link auth-link--signup">Sign Up</a>
</div>
</div>
{{- $rssURL := "/index.xml" -}}
{{- with .OutputFormats.Get "rss" -}}
{{- $rssURL = .RelPermalink -}}
{{- end -}}
<a href="{{ $rssURL }}" class="rss-subscribe__link rss-subscribe__link--desktop" title="Subscribe via RSS">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="10" height="10" fill="currentColor" aria-hidden="true">
<path d="M6.18 15.64a2.18 2.18 0 0 1 2.18 2.18C8.36 19.01 7.38 20 6.18 20C4.98 20 4 19.01 4 17.82a2.18 2.18 0 0 1 2.18-2.18M4 4.44A15.56 15.56 0 0 1 19.56 20h-2.83A12.73 12.73 0 0 0 4 7.27V4.44m0 5.66a9.9 9.9 0 0 1 9.9 9.9h-2.83A7.07 7.07 0 0 0 4 12.93V10.1z"/>
</svg>
<span>Subscribe</span>
</a>
<!-- Mobile: combined dropdown -->
<div class="brand__mobile-menu">
<input type="checkbox" id="mobile-menu-check" class="brand__mobile-check" />
<label class="brand__mobile-toggle" for="mobile-menu-check" aria-label="Menu">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/></svg>
</label>
<div class="brand__mobile-links">
<a href="/login/" class="mobile-link">Login</a>
<a href="/signup/" class="mobile-link">Sign Up</a>
<a href="{{ $rssURL }}" class="mobile-link mobile-link--subscribe">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="12" height="12" fill="currentColor" aria-hidden="true"><path d="M6.18 15.64a2.18 2.18 0 0 1 2.18 2.18C8.36 19.01 7.38 20 6.18 20C4.98 20 4 19.01 4 17.82a2.18 2.18 0 0 1 2.18-2.18M4 4.44A15.56 15.56 0 0 1 19.56 20h-2.83A12.73 12.73 0 0 0 4 7.27V4.44m0 5.66a9.9 9.9 0 0 1 9.9 9.9h-2.83A7.07 7.07 0 0 0 4 12.93V10.1z"/></svg>
Subscribe
</a>
</div>
</div>
</div>
</div>
{{ partial "header.html" . }}
</header>
<main class="main">{{ block "main" . }}{{ end }}</main>
<footer class="footer">{{ partial "footer.html" . }}</footer>
{{ partial "body/body-end.html" . }}
</body>
</html>

View File

@@ -0,0 +1,61 @@
{{ define "main" }}
{{ $semesterName := .Title }}
<nav class="uninotes-breadcrumbs breadcrumbs">
<a href="/uninotes/">UniNotes</a>
<span>{{ $semesterName }}</span>
</nav>
<h1>{{ $semesterName }}</h1>
{{/* Collect unique subject codes from posts tagged with this semester */}}
{{ $subjectCodes := slice }}
{{ range .Pages }}
{{ $raw := .Params.subjectcode }}
{{ $code := "" }}
{{ if reflect.IsSlice $raw }}
{{ $code = index $raw 0 }}
{{ else }}
{{ $code = $raw }}
{{ end }}
{{ if and $code (not (in $subjectCodes $code)) }}
{{ $subjectCodes = $subjectCodes | append $code }}
{{ end }}
{{ end }}
{{ $subjectCodes = sort $subjectCodes }}
<ol class="uninotes-list uninotes-list--subjects">
{{ range $subjectCodes }}
{{ $tp := site.GetPage (printf "/subjectcode/%s" (. | urlize)) }}
<li class="uninotes-list__item">
{{ if $tp }}
<a class="uninotes-list__link" href="{{ $tp.RelPermalink }}">{{ . }}</a>
{{ else }}
<span class="uninotes-list__link">{{ . }}</span>
{{ end }}
</li>
{{ end }}
</ol>
{{/* Semester prev/next */}}
{{ $allSemesters := site.Taxonomies.semester.Alphabetical }}
{{ if gt (len $allSemesters) 1 }}
{{ $currentIdx := 0 }}
{{ range $i, $s := $allSemesters }}
{{ if eq $s.Page.Title $semesterName }}{{ $currentIdx = $i }}{{ end }}
{{ end }}
<nav class="page-nav">
{{ if gt $currentIdx 0 }}
{{ $prev := index $allSemesters (sub $currentIdx 1) }}
<a class="page-nav__previous-link" href="{{ $prev.Page.RelPermalink }}">← {{ $prev.Page.Title }}</a>
{{ end }}
{{ if lt $currentIdx (sub (len $allSemesters) 1) }}
{{ $next := index $allSemesters (add $currentIdx 1) }}
<a class="page-nav__next-link" href="{{ $next.Page.RelPermalink }}">{{ $next.Page.Title }} →</a>
{{ end }}
</nav>
{{ end }}
{{ end }}

View File

@@ -1,13 +1,17 @@
{{ define "main" }}
{{ $pages := .Pages.ByTitle }}
{{ $sectionPagerSize := or site.Params.sectionPagerSize 10 }}
{{ $paginator := .Paginate $pages $sectionPagerSize }}
{{ .Content }}
<h1>Services</h1>
{{ range $index, $page := $paginator.Pages }}
<h2 class="home-post-title">{{ add $index 1 }}. <a href="{{ $page.RelPermalink }}">{{ $page.LinkTitle }}</a></h2>
<nav class="uninotes-breadcrumbs breadcrumbs">
<a href="/services/">Services</a>
</nav>
<h1>Services</h1>
<ol class="uninotes-list uninotes-list--subjects">
{{ range .Pages.ByTitle }}
<li class="uninotes-list__item">
<a class="uninotes-list__link" href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
</li>
{{ end }}
<nav class="paginator">
{{- partial "pagination.html" . }} {{/* embedded template */}}
</nav>
</ol>
{{ end }}

View File

@@ -1,27 +1,31 @@
{{ define "main" }}
<nav class="uninotes-breadcrumbs breadcrumbs">
<a href="/services/">Services</a>
<span>{{ .Title }}</span>
</nav>
<h1>{{ .Title }}</h1>
{{ .Content }}
{{/* Prev/next among sibling services */}}
{{ $allPages := .CurrentSection.Pages.ByTitle }}
{{ $currentTitle := .Title }}
{{ $allPages := .Section | .Site.GetPage }}
{{ $sortedPages := $allPages.Pages.ByTitle }}
{{ $currentIndex := 0 }}
{{ range $index, $page := $sortedPages }}
{{ if eq $page.Title $currentTitle }}
{{ $currentIndex = $index }}
{{ end }}
{{ $currentIdx := 0 }}
{{ range $i, $p := $allPages }}
{{ if eq $p.Title $currentTitle }}{{ $currentIdx = $i }}{{ end }}
{{ end }}
{{ if gt (len $sortedPages) 1 }}
{{ if gt (len $allPages) 1 }}
<nav class="page-nav">
{{ if gt $currentIndex 0 }}
{{ $prevPage := index $sortedPages (sub $currentIndex 1) }}
<a href="{{ $prevPage.RelPermalink }}">{{ i18n "previousPage" }}{{ $prevPage.LinkTitle }}</a>
{{ if gt $currentIdx 0 }}
{{ $prev := index $allPages (sub $currentIdx 1) }}
<a class="page-nav__previous-link" href="{{ $prev.RelPermalink }}">{{ $prev.LinkTitle }}</a>
{{ end }}
{{ if lt $currentIndex (sub (len $sortedPages) 1) }}
{{ $nextPage := index $sortedPages (add $currentIndex 1) }}
<a href="{{ $nextPage.RelPermalink }}">{{ i18n "nextPage" }}{{ $nextPage.LinkTitle }}</a>
{{ if lt $currentIdx (sub (len $allPages) 1) }}
{{ $next := index $allPages (add $currentIdx 1) }}
<a class="page-nav__next-link" href="{{ $next.RelPermalink }}">{{ $next.LinkTitle }}</a>
{{ end }}
</nav>
{{ end }}

View File

@@ -0,0 +1,65 @@
<!doctype html>
<html
class="html"
lang="{{ or site.Language.LanguageCode site.Language.Lang }}"
dir="{{ or site.Language.LanguageDirection `ltr` }}"
>
<head>
{{ partial "head.html" . }}
</head>
<body class="body">
<header class="header">
<div class="brand">
<img src="/logo.png" alt="Freedoms4 logo" />
<h1>Freedoms4</h1>
<div class="brand__actions">
<button class="theme-toggle" id="theme-toggle" aria-label="Toggle theme" title="Toggle dark/light mode">
<svg class="theme-toggle__sun" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><path d="M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41l-1.06-1.06zm1.06-12.37l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06c.39-.39.39-1.03 0-1.41s-1.03-.39-1.41 0zM7.05 18.36l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06c.39-.39.39-1.03 0-1.41s-1.03-.39-1.41 0z"/></svg>
<svg class="theme-toggle__moon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><path d="M21 12.79A9 9 0 1 1 11.21 3a7 7 0 0 0 9.79 9.79z"/></svg>
</button>
<!-- Desktop: account + subscribe -->
<div class="brand__auth brand__auth--desktop">
<input type="checkbox" id="auth-dropdown" class="brand__auth-check" />
<label class="brand__auth-toggle" for="auth-dropdown" tabindex="0" aria-label="Account options">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="12" height="12" fill="currentColor"><path d="M12 12c2.7 0 4.8-2.1 4.8-4.8S14.7 2.4 12 2.4 7.2 4.5 7.2 7.2 9.3 12 12 12zm0 2.4c-3.2 0-9.6 1.6-9.6 4.8v2.4h19.2v-2.4c0-3.2-6.4-4.8-9.6-4.8z"/></svg>
</label>
<div class="brand__auth-links">
<a href="/login/" class="auth-link auth-link--login">Login</a>
<a href="/signup/" class="auth-link auth-link--signup">Sign Up</a>
</div>
</div>
{{- $rssURL := "/index.xml" -}}
{{- with .OutputFormats.Get "rss" -}}
{{- $rssURL = .RelPermalink -}}
{{- end -}}
<a href="{{ $rssURL }}" class="rss-subscribe__link rss-subscribe__link--desktop" title="Subscribe via RSS">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="10" height="10" fill="currentColor" aria-hidden="true">
<path d="M6.18 15.64a2.18 2.18 0 0 1 2.18 2.18C8.36 19.01 7.38 20 6.18 20C4.98 20 4 19.01 4 17.82a2.18 2.18 0 0 1 2.18-2.18M4 4.44A15.56 15.56 0 0 1 19.56 20h-2.83A12.73 12.73 0 0 0 4 7.27V4.44m0 5.66a9.9 9.9 0 0 1 9.9 9.9h-2.83A7.07 7.07 0 0 0 4 12.93V10.1z"/>
</svg>
<span>Subscribe</span>
</a>
<!-- Mobile: combined dropdown -->
<div class="brand__mobile-menu">
<input type="checkbox" id="mobile-menu-check" class="brand__mobile-check" />
<label class="brand__mobile-toggle" for="mobile-menu-check" aria-label="Menu">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/></svg>
</label>
<div class="brand__mobile-links">
<a href="/login/" class="mobile-link">Login</a>
<a href="/signup/" class="mobile-link">Sign Up</a>
<a href="{{ $rssURL }}" class="mobile-link mobile-link--subscribe">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="12" height="12" fill="currentColor" aria-hidden="true"><path d="M6.18 15.64a2.18 2.18 0 0 1 2.18 2.18C8.36 19.01 7.38 20 6.18 20C4.98 20 4 19.01 4 17.82a2.18 2.18 0 0 1 2.18-2.18M4 4.44A15.56 15.56 0 0 1 19.56 20h-2.83A12.73 12.73 0 0 0 4 7.27V4.44m0 5.66a9.9 9.9 0 0 1 9.9 9.9h-2.83A7.07 7.07 0 0 0 4 12.93V10.1z"/></svg>
Subscribe
</a>
</div>
</div>
</div>
</div>
{{ partial "header.html" . }}
</header>
<main class="main">{{ block "main" . }}{{ end }}</main>
<footer class="footer">{{ partial "footer.html" . }}</footer>
{{ partial "body/body-end.html" . }}
</body>
</html>

View File

@@ -0,0 +1,87 @@
{{ define "main" }}
{{ $subjectCode := .Title }}
{{/* Find which semester this subject belongs to */}}
{{ $semester := "" }}
{{ range .Pages }}
{{ if eq $semester "" }}
{{ $raw := .Params.semester }}
{{ if reflect.IsSlice $raw }}
{{ $semester = index $raw 0 }}
{{ else }}
{{ $semester = $raw }}
{{ end }}
{{ end }}
{{ end }}
{{/* Breadcrumbs */}}
<nav class="uninotes-breadcrumbs breadcrumbs">
<a href="/uninotes/">UniNotes</a>
{{ if $semester }}
{{ $semPage := site.GetPage (printf "/semester/%s" ($semester | urlize)) }}
{{ if $semPage }}
<a href="{{ $semPage.RelPermalink }}">{{ $semester }}</a>
{{ end }}
{{ end }}
<span>{{ $subjectCode }}</span>
</nav>
<h1>{{ $subjectCode }}</h1>
{{/* List units sorted by date */}}
<ul class="uninotes-list uninotes-list--units">
{{ range .Pages.ByDate }}
<li class="uninotes-list__item">
<a class="uninotes-list__link" href="{{ .RelPermalink }}">
{{ with .Params.unit }}{{ . }}{{ else }}{{ .Title }}{{ end }}
</a>
</li>
{{ end }}
</ul>
{{/* Subject prev/next — siblings are other subjectcodes in the same semester */}}
{{ if $semester }}
{{ $semPage := site.GetPage (printf "/semester/%s" ($semester | urlize)) }}
{{ if $semPage }}
{{ $siblingCodes := slice }}
{{ range $semPage.Pages }}
{{ $raw := .Params.subjectcode }}
{{ $code := "" }}
{{ if reflect.IsSlice $raw }}
{{ $code = index $raw 0 }}
{{ else }}
{{ $code = $raw }}
{{ end }}
{{ if and $code (not (in $siblingCodes $code)) }}
{{ $siblingCodes = $siblingCodes | append $code }}
{{ end }}
{{ end }}
{{ $siblingCodes = sort $siblingCodes }}
{{ if gt (len $siblingCodes) 1 }}
{{ $currentIdx := 0 }}
{{ range $i, $c := $siblingCodes }}
{{ if eq $c $subjectCode }}{{ $currentIdx = $i }}{{ end }}
{{ end }}
<nav class="page-nav">
{{ if gt $currentIdx 0 }}
{{ $prevCode := index $siblingCodes (sub $currentIdx 1) }}
{{ $prevPage := site.GetPage (printf "/subjectcode/%s" ($prevCode | urlize)) }}
{{ if $prevPage }}
<a class="page-nav__previous-link" href="{{ $prevPage.RelPermalink }}">← {{ $prevCode }}</a>
{{ end }}
{{ end }}
{{ if lt $currentIdx (sub (len $siblingCodes) 1) }}
{{ $nextCode := index $siblingCodes (add $currentIdx 1) }}
{{ $nextPage := site.GetPage (printf "/subjectcode/%s" ($nextCode | urlize)) }}
{{ if $nextPage }}
<a class="page-nav__next-link" href="{{ $nextPage.RelPermalink }}">{{ $nextCode }} →</a>
{{ end }}
{{ end }}
</nav>
{{ end }}
{{ end }}
{{ end }}
{{ end }}

View File

@@ -1 +1,20 @@
{{ define "main" }} <h1><a href="/blog/" style="text-decoration: none; color: var(--accent-color);">All Posts</a> | Categories</h1> <section class="term-list"> {{ range .Data.Terms.Alphabetical }} <h2 class="term-list__item"> <a class="term-list__link" href="{{ .Page.RelPermalink }}"> {{ .Page.Title }} ({{ .Count }}) </a> </h2> {{ end }} </section> {{ end }}
{{ define "main" }}
<nav class="uninotes-breadcrumbs breadcrumbs">
<a href="/blog/">Blog</a>
<span>Categories</span>
</nav>
<h1><a href="/blog/" style="text-decoration: none; color: var(--accent-color);">All Posts</a> | Categories</h1>
<section class="term-list">
{{ range .Data.Terms.Alphabetical }}
<h2 class="term-list__item">
<a class="term-list__link" href="{{ .Page.RelPermalink }}">
{{ .Page.Title }} ({{ .Count }})
</a>
</h2>
{{ end }}
</section>
{{ end }}

View File

@@ -0,0 +1,19 @@
{{ define "main" }}
<nav class="uninotes-breadcrumbs breadcrumbs">
<a href="/uninotes/">UniNotes</a>
</nav>
<h1>UniNotes</h1>
{{/* Pull all semester terms from the taxonomy */}}
{{ $semesterTaxonomy := site.Taxonomies.semester }}
{{ $semesters := $semesterTaxonomy.Alphabetical }}
<ul class="uninotes-list">
{{ range $semesters }}
<li class="uninotes-list__item">
<a class="uninotes-list__link" href="{{ .Page.RelPermalink }}">{{ .Page.Title }}</a>
</li>
{{ end }}
</ul>
{{ end }}

View File

@@ -0,0 +1,78 @@
{{ define "main" }}
{{ $semesterRaw := .Params.semester }}
{{ $subjectcodeRaw := .Params.subjectcode }}
{{ $semester := "" }}
{{ if reflect.IsSlice $semesterRaw }}
{{ $semester = index $semesterRaw 0 }}
{{ else }}
{{ $semester = $semesterRaw }}
{{ end }}
{{ $subjectcode := "" }}
{{ if reflect.IsSlice $subjectcodeRaw }}
{{ $subjectcode = index $subjectcodeRaw 0 }}
{{ else }}
{{ $subjectcode = $subjectcodeRaw }}
{{ end }}
{{/* Breadcrumbs */}}
<nav class="uninotes-breadcrumbs breadcrumbs">
<a href="/uninotes/">UniNotes</a>
{{ if $semester }}
{{ $semPage := site.GetPage (printf "/semester/%s" ($semester | urlize)) }}
{{ if $semPage }}
<a href="{{ $semPage.RelPermalink }}">{{ $semester }}</a>
{{ end }}
{{ end }}
{{ if $subjectcode }}
{{ $subPage := site.GetPage (printf "/subjectcode/%s" ($subjectcode | urlize)) }}
{{ if $subPage }}
<a href="{{ $subPage.RelPermalink }}">{{ $subjectcode }}</a>
{{ end }}
{{ end }}
<span>{{ .Params.unit | default .Title }}</span>
</nav>
{{/* Metadata pills */}}
<div class="uninotes-meta">
{{ with $semester }}<span class="uninotes-meta__pill">{{ . }}</span>{{ end }}
{{ with $subjectcode }}<span class="uninotes-meta__pill">{{ . }}</span>{{ end }}
</div>
<h1>{{ .Params.unit | default .Title }}</h1>
{{ partial "main/dates.html" . }}
{{ partial "page/toc.html" . }}
{{ .Content }}
{{ partial "page/terms.html" (dict "taxonomy" "tags" "page" .) }}
{{ partial "page/terms.html" (dict "taxonomy" "categories" "page" .) }}
{{/* Next/prev: siblings = other posts with same subjectcode, sorted by date */}}
{{ if $subjectcode }}
{{ $subPage := site.GetPage (printf "/subjectcode/%s" ($subjectcode | urlize)) }}
{{ if $subPage }}
{{ $siblings := $subPage.Pages.ByDate }}
{{ $currentTitle := .Title }}
{{ $currentIdx := 0 }}
{{ range $i, $p := $siblings }}
{{ if eq $p.Title $currentTitle }}{{ $currentIdx = $i }}{{ end }}
{{ end }}
{{ if gt (len $siblings) 1 }}
<nav class="page-nav">
{{ if gt $currentIdx 0 }}
{{ $prev := index $siblings (sub $currentIdx 1) }}
<a class="page-nav__previous-link" href="{{ $prev.RelPermalink }}">← {{ $prev.Params.unit | default $prev.Title }}</a>
{{ end }}
{{ if lt $currentIdx (sub (len $siblings) 1) }}
{{ $next := index $siblings (add $currentIdx 1) }}
<a class="page-nav__next-link" href="{{ $next.RelPermalink }}">{{ $next.Params.unit | default $next.Title }} →</a>
{{ end }}
</nav>
{{ end }}
{{ end }}
{{ end }}
{{ partial "page/page-end.html" . }}
{{ end }}