Compare commits

..

10 Commits

Author SHA1 Message Date
a54226801c Merge branch 'custom-social' 2025-09-05 22:46:15 +10:00
5392098d00 feat: add custom social links
- add custom type for social.links. User can set type = custom with id
  as a custom URL.

  [[social.links]]
    type = "custom"
    id = "https://example.com/"
    icon = "fab fa-github"
2025-09-04 21:33:17 +10:00
508f8ed841 fix: update layouts to add hugo.IsMultilingual
- Update layouts/partials/language-selector.html to add
  hugo.IsMultilingual for multilanguage support to hide drop down menu
- Update layours/partials/sidebar.html to add hugo.IsMultilingual to
  hide language icon.
2025-09-03 21:10:01 +10:00
83d24c4127 release: v1.0.2 2025-06-05 16:06:08 +08:00
f06f188d38 chore(dependencies): update dependencies 2025-06-05 16:06:08 +08:00
7973ebbf9d fix(mathjax): move MathJax initialization to global scope
Updated MathJax initialization to be accessible globally by assigning it to the window object. This change ensures that MathJax is properly loaded and available for use across the application.

Additionally, added 'defer' attribute to script tags for correct loading order.
2025-06-05 16:06:08 +08:00
5e13298a65 fix(taxonomy): ensure category existence check before accessing parameters
Updated the category terms layout to check for the existence of the "categories" parameter before attempting to access its length, preventing potential errors.
2025-06-05 16:06:08 +08:00
c58e328fe7 fix(layout): update post filtering to use correct type
Changed the filtering criteria for posts in the layout from "Section" to "Type" to ensure accurate post retrieval.
2025-06-05 16:06:08 +08:00
37bb9cb449 fix: correct footer link 2025-05-12 11:48:49 +08:00
58c79a5381 release: v1.0.1 2025-05-12 11:29:18 +08:00
15 changed files with 135 additions and 48 deletions

View File

@ -1,5 +1,4 @@
document.addEventListener('DOMContentLoaded', () => { window.MathJax = {
MathJax = {
tex: { tex: {
inlineMath: [ inlineMath: [
['$', '$'], ['$', '$'],
@ -12,4 +11,3 @@ document.addEventListener('DOMContentLoaded', () => {
tags: 'ams' tags: 'ams'
} }
}; };
});

View File

@ -0,0 +1,6 @@
---
title: Test 2
date: 2025-04-11 00:34:00 +0800
description: >-
Test 2
---

View File

@ -0,0 +1,6 @@
---
title: Test 3
date: 2025-04-11 00:34:00 +0800
description: >-
Test 3
---

View File

@ -0,0 +1,6 @@
---
title: Test 4
date: 2025-04-11 00:34:00 +0800
description: >-
Test 4
---

View File

@ -0,0 +1,8 @@
---
title: Test 1
date: 2025-04-11 00:34:00 +0800
description: >-
Test 1
---
123

3
go.mod
View File

@ -5,5 +5,6 @@ go 1.24.2
require ( require (
github.com/geekifan/chirpy-static-assets v0.0.0-20250507021825-887e490b15f2 // indirect github.com/geekifan/chirpy-static-assets v0.0.0-20250507021825-887e490b15f2 // indirect
github.com/gohugoio/hugo-mod-bootstrap-scss/v5 v5.20300.20400 // indirect github.com/gohugoio/hugo-mod-bootstrap-scss/v5 v5.20300.20400 // indirect
github.com/twbs/bootstrap v5.3.5+incompatible // indirect github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2 v2.21100.20000 // indirect
github.com/twbs/bootstrap v5.3.6+incompatible // indirect
) )

5
go.sum
View File

@ -2,7 +2,8 @@ github.com/geekifan/chirpy-static-assets v0.0.0-20250507021825-887e490b15f2 h1:r
github.com/geekifan/chirpy-static-assets v0.0.0-20250507021825-887e490b15f2/go.mod h1:F58Ey9QK/tEgIxwcQSqAgV4ZA24mCb714B58D4Syv/0= github.com/geekifan/chirpy-static-assets v0.0.0-20250507021825-887e490b15f2/go.mod h1:F58Ey9QK/tEgIxwcQSqAgV4ZA24mCb714B58D4Syv/0=
github.com/gohugoio/hugo-mod-bootstrap-scss/v5 v5.20300.20400 h1:L6+F22i76xmeWWwrtijAhUbf3BiRLmpO5j34bgl1ggU= github.com/gohugoio/hugo-mod-bootstrap-scss/v5 v5.20300.20400 h1:L6+F22i76xmeWWwrtijAhUbf3BiRLmpO5j34bgl1ggU=
github.com/gohugoio/hugo-mod-bootstrap-scss/v5 v5.20300.20400/go.mod h1:uekq1D4ebeXgduLj8VIZy8TgfTjrLdSl6nPtVczso78= github.com/gohugoio/hugo-mod-bootstrap-scss/v5 v5.20300.20400/go.mod h1:uekq1D4ebeXgduLj8VIZy8TgfTjrLdSl6nPtVczso78=
github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2 v2.21100.20000 h1:GZxx4Hc+yb0/t3/rau1j8XlAxLE4CyXns2fqQbyqWfs=
github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2 v2.21100.20000/go.mod h1:mFberT6ZtcchrsDtfvJM7aAH2bDKLdOnruUHl0hlapI= github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2 v2.21100.20000/go.mod h1:mFberT6ZtcchrsDtfvJM7aAH2bDKLdOnruUHl0hlapI=
github.com/twbs/bootstrap v5.3.3+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0= github.com/twbs/bootstrap v5.3.3+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0=
github.com/twbs/bootstrap v5.3.5+incompatible h1:6XrrFNMsiTTFcVTBf2886FO2XUNtwSE+QPv1os0uAA4= github.com/twbs/bootstrap v5.3.6+incompatible h1:efmXVyq839m5QQ0+JBUdQQ1TrmoBqvQ5kRhUueKsH+4=
github.com/twbs/bootstrap v5.3.5+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0= github.com/twbs/bootstrap v5.3.6+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0=

View File

@ -8,7 +8,7 @@ defaultContentLanguageInSubdir = false
pagerSize = 5 pagerSize = 5
[params] [params]
theme_version = "1.0.0" theme_version = "1.0.2"
[outputs] [outputs]
home = ["HTML", "RSS", "JSON"] home = ["HTML", "RSS", "JSON"]

View File

@ -1,5 +1,5 @@
{{ define "main" }} {{ define "main" }}
{{ $all_posts := where .Site.RegularPages "Section" "post" }} {{ $all_posts := where .Site.RegularPages "Type" "post" }}
{{ $all_pinned := where $all_posts "Params.pin" true }} {{ $all_pinned := where $all_posts "Params.pin" true }}
{{ $all_normal := where $all_posts "Params.pin" "!=" true }} {{ $all_normal := where $all_posts "Params.pin" "!=" true }}

View File

@ -32,7 +32,7 @@
data-bs-toggle="tooltip" data-bs-toggle="tooltip"
data-bs-placement="top" data-bs-placement="top"
title="v%s" title="v%s"
href="https://github.com/cotes2020/jekyll-theme-chirpy" href="https://github.com/geekifan/hugo-theme-chirpy"
target="_blank" target="_blank"
rel="noopener" rel="noopener"
>Chirpy</a>` .Site.Params.theme_version -}} >Chirpy</a>` .Site.Params.theme_version -}}

View File

@ -89,9 +89,9 @@
{{ if .Params.math }} {{ if .Params.math }}
<!-- MathJax --> <!-- MathJax -->
{{ $mathjaxConfig := resources.Get "js/mathjax.js" | minify | fingerprint }} {{ $mathjaxConfig := resources.Get "js/mathjax.js" | minify | fingerprint }}
<script src="{{ $mathjaxConfig.RelPermalink }}"></script> <script src="{{ $mathjaxConfig.RelPermalink }}" defer></script>
<script async src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=es6"></script> <script async src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="{{ $data.mathjax.js }}"></script> <script id="MathJax-script" src="{{ $data.mathjax.js }}" defer></script>
{{ end }} {{ end }}
<!-- Pageviews --> <!-- Pageviews -->

View File

@ -1,3 +1,4 @@
{{ if hugo.IsMultilingual }}
<div class="lang-dropdown"> <div class="lang-dropdown">
<select class="lang-select" onchange="location = this.value;"> <select class="lang-select" onchange="location = this.value;">
{{ $currentLang := .Site.Language.Lang }} {{ $currentLang := .Site.Language.Lang }}
@ -9,3 +10,4 @@
{{ end }} {{ end }}
</select> </select>
</div> </div>
{{ end }}

View File

@ -34,12 +34,15 @@
</li> </li>
<!-- .nav-item --> <!-- .nav-item -->
{{ end }} {{ end }}
{{ if hugo.IsMultilingual }}
<li class="nav-item mt-4"> <li class="nav-item mt-4">
<a class="nav-link no-hover"> <a class="nav-link no-hover">
<i class="fa-fw fas fa-language"></i> <i class="fa-fw fas fa-language"></i>
{{ partial "language-selector.html" . }} {{ partial "language-selector.html" . }}
</a> </a>
</li> </li>
{{ end }}
</ul> </ul>
</nav> </nav>
@ -66,6 +69,8 @@
{{ $url = printf "mailto:%s" .id }} {{ $url = printf "mailto:%s" .id }}
{{ else if eq .type "rss" }} {{ else if eq .type "rss" }}
{{ $url = "index.xml" | absLangURL }} {{ $url = "index.xml" | absLangURL }}
{{ else if eq .type "custom" }}
{{ $url = printf "%s" .id }}
{{ else }} {{ else }}
{{ $url = .url }} {{ $url = .url }}
{{ end }} {{ end }}

50
layouts/section/list.html Normal file
View File

@ -0,0 +1,50 @@
{{ define "main" }}
<main class="section-page">
<header class="section-header">
<h1>{{ .Title }}</h1>
{{ with .Description }}
<p class="section-description">{{ . }}</p>
{{ end }}
</header>
<div class="section-content">
{{ .Content }}
</div>
{{ if .Pages }}
<div class="section-pages">
<h2>Subsections & Pages</h2>
<ul class="page-list">
{{ range .Pages }}
<li>
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
{{ if .IsSection }}
<span class="badge">Section</span>
{{ end }}
{{ with .Description }}
<p class="page-description">{{ . }}</p>
{{ end }}
</li>
{{ end }}
</ul>
</div>
{{ end }}
{{ if .Sections }}
<div class="section-subsections">
<h2>Subsections</h2>
<div class="subsection-grid">
{{ range .Sections }}
<div class="subsection-card">
<h3><a href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
{{ with .Description }}
<p>{{ . }}</p>
{{ end }}
<a href="{{ .RelPermalink }}" class="btn">View Section</a>
</div>
{{ end }}
</div>
</div>
{{ end }}
</main>
{{ end }}

View File

@ -9,10 +9,12 @@
<!-- get all parent categories --> <!-- get all parent categories -->
{{ $parentCategories := slice }} {{ $parentCategories := slice }}
{{ range $allPages }} {{ range $allPages }}
{{ if isset .Params "categories" }}
{{ if gt (len .Params.categories) 0 }} {{ if gt (len .Params.categories) 0 }}
{{ $parentCategories = $parentCategories | append (index .Params.categories 0) }} {{ $parentCategories = $parentCategories | append (index .Params.categories 0) }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }}
{{ $parentCategories = $parentCategories | uniq | sort }} {{ $parentCategories = $parentCategories | uniq | sort }}
<!-- create card for each parent category --> <!-- create card for each parent category -->
@ -23,6 +25,7 @@
<!-- get all pages and subcategories related to the parent category --> <!-- get all pages and subcategories related to the parent category -->
{{ range $allPages }} {{ range $allPages }}
{{ if isset .Params "categories" }}
{{ if gt (len .Params.categories) 0 }} {{ if gt (len .Params.categories) 0 }}
{{ if eq (index .Params.categories 0) $parentName }} {{ if eq (index .Params.categories 0) $parentName }}
{{ $parentPages = $parentPages | append . }} {{ $parentPages = $parentPages | append . }}
@ -32,6 +35,7 @@
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }}
{{ $subcategories = $subcategories | uniq | sort }} {{ $subcategories = $subcategories | uniq | sort }}
<div class="card categories mb-3"> <div class="card categories mb-3">