Compare commits

...

12 Commits

Author SHA1 Message Date
98acc1f743 chore: update go files 2025-09-06 12:04:01 +10:00
02da26940c chore: update README.md 2025-09-06 00:23:50 +10:00
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
16 changed files with 145 additions and 103 deletions

View File

@ -1,61 +1,21 @@
<!-- markdownlint-disable-next-line -->
<div align="center">
<!-- markdownlint-disable-next-line -->
# Chirpy Hugo Theme
# Chirpy Hugo Theme
A hugo version of [Chirpy Jekyll Theme]([chirpy-jekyll]). A minimal, responsive, and feature-rich Hugo theme for technical writing.
[**Live Demo** →][demo] | [**Jekyll Theme** →][chirpy-jekyll]
[![Devices Mockup](https://chirpy-img.netlify.app/commons/devices-mockup.png)][demo]
A Hugo version of the [Chirpy Jekyll Theme](https://github.com/cotes2020/jekyll-theme-chirpy)
</div>
## Features
---
- Native i18n Support (thanks to [Hugo][hugo])
- Dark Theme
- Localized UI language
- Pinned Posts on Home Page
- Hierarchical Categories
- Trending Tags
- Table of Contents
- Last Modified Date
- Syntax Highlighting
- Mathematical Expressions
- Mermaid Diagrams & Flowcharts (🚧 Work in Progress)
- Dark Mode Images
- Embed Media
- Comment Systems (🙋‍♂️ Call for Test)
- Built-in Search
- RSS Feeds
- PWA (🚧 Work in Progress)
- Web Analytics
- SEO & Performance Optimization
# Comprofix
## Quick Start
Use this template: [geekifan/chirpy-starter](https://github.com/geekifan/chirpy-starter)
This repository contains all merges and changes from my development repository so it can be used as a module for the [comprofix.com](https://comprofix.com) website.
## Documentation
## Related Repositories
To learn how to use, develop, and upgrade the project, please refer to the [Wiki][wiki].
- **Development branch:** [comprofix/hugo-theme-chirpy](https://github.com/comprofix/hugo-theme-chirpy)
- **Original fork:** [geekifan/hugo-theme-chirpy/](https://github.com/geekifan/hugo-theme-chirpy/)
## Contributing
Contributions (_pull requests_, _issues_, and _discussions_) are what make the open-source community such an amazing place
to learn, inspire, and create. Any contributions you make are greatly appreciated.
## Credits
Thanks to the theme [Chirpy Jekyll Theme][chirpy-jekyll] and all its contributors.
## License
This project is published under [MIT License][license].
[chirpy-jekyll]: https://github.com/cotes2020/jekyll-theme-chirpy
[license]: https://github.com/geekifan/hugo-theme-chirpy/blob/main/LICENSE
[hugo]: https://gohugo.io/
[demo]: https://geekifan.github.io/chirpy-starter
[wiki]: https://geekifan.github.io/chirpy-starter

View File

@ -1,15 +1,13 @@
document.addEventListener('DOMContentLoaded', () => {
MathJax = {
tex: {
inlineMath: [
['$', '$'],
['\\(', '\\)']
],
displayMath: [
['$$', '$$'],
['\\[', '\\]']
],
tags: 'ams'
}
};
});
window.MathJax = {
tex: {
inlineMath: [
['$', '$'],
['\\(', '\\)']
],
displayMath: [
['$$', '$$'],
['\\[', '\\]']
],
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

7
go.mod
View File

@ -1,9 +1,8 @@
module github.com/geekifan/hugo-theme-chirpy
module git.comprofix.com/mmckinnon/hugo-theme-chirpy
go 1.24.2
go 1.25.1
require (
github.com/geekifan/chirpy-static-assets v0.0.0-20250507021825-887e490b15f2 // indirect
git.comprofix.com/mmckinnon/chirpy-static-assets v0.0.0-20250906020312-767f82775038 // indirect
github.com/gohugoio/hugo-mod-bootstrap-scss/v5 v5.20300.20400 // indirect
github.com/twbs/bootstrap v5.3.5+incompatible // indirect
)

6
go.sum
View File

@ -1,8 +1,6 @@
github.com/geekifan/chirpy-static-assets v0.0.0-20250507021825-887e490b15f2 h1:r/j8ns7StZlMJeDd5mRPZ5RgogdsegvrVHPr2y955/U=
github.com/geekifan/chirpy-static-assets v0.0.0-20250507021825-887e490b15f2/go.mod h1:F58Ey9QK/tEgIxwcQSqAgV4ZA24mCb714B58D4Syv/0=
git.comprofix.com/mmckinnon/chirpy-static-assets v0.0.0-20250906020312-767f82775038 h1:bA/NjPJeRttohR586J50qQCcjBuqiU/n1sjFmAOR6NY=
git.comprofix.com/mmckinnon/chirpy-static-assets v0.0.0-20250906020312-767f82775038/go.mod h1:kdeC0vGA6Iiww0uPloRE7vg0tuykfC/ncHMWpIgLWr4=
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-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.5+incompatible h1:6XrrFNMsiTTFcVTBf2886FO2XUNtwSE+QPv1os0uAA4=
github.com/twbs/bootstrap v5.3.5+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0=

View File

@ -8,7 +8,7 @@ defaultContentLanguageInSubdir = false
pagerSize = 5
[params]
theme_version = "1.0.0"
theme_version = "1.0.2"
[outputs]
home = ["HTML", "RSS", "JSON"]
@ -22,7 +22,7 @@ defaultContentLanguageInSubdir = false
path = "github.com/gohugoio/hugo-mod-bootstrap-scss/v5"
[[module.imports]]
path = "github.com/geekifan/chirpy-static-assets"
path = "git.comprofix.com/mmckinnon/chirpy-static-assets"
[[module.imports.mounts]]
source = "."

View File

@ -1,5 +1,5 @@
{{ 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_normal := where $all_posts "Params.pin" "!=" true }}

View File

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

View File

@ -89,9 +89,9 @@
{{ if .Params.math }}
<!-- MathJax -->
{{ $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 id="MathJax-script" async src="{{ $data.mathjax.js }}"></script>
<script id="MathJax-script" src="{{ $data.mathjax.js }}" defer></script>
{{ end }}
<!-- Pageviews -->

View File

@ -1,11 +1,13 @@
<div class="lang-dropdown">
<select class="lang-select" onchange="location = this.value;">
{{ $currentLang := .Site.Language.Lang }}
{{ $siteBase := strings.TrimSuffix "/" .Site.BaseURL }}
{{ range .Site.Languages }}
<option value="{{ $siteBase }}/{{ .Lang }}/" {{ if eq .Lang $currentLang }}selected{{ end }}>
{{ .LanguageName }}
</option>
{{ end }}
</select>
</div>
{{ if hugo.IsMultilingual }}
<div class="lang-dropdown">
<select class="lang-select" onchange="location = this.value;">
{{ $currentLang := .Site.Language.Lang }}
{{ $siteBase := strings.TrimSuffix "/" .Site.BaseURL }}
{{ range .Site.Languages }}
<option value="{{ $siteBase }}/{{ .Lang }}/" {{ if eq .Lang $currentLang }}selected{{ end }}>
{{ .LanguageName }}
</option>
{{ end }}
</select>
</div>
{{ end }}

View File

@ -34,12 +34,15 @@
</li>
<!-- .nav-item -->
{{ end }}
<li class="nav-item mt-4">
<a class="nav-link no-hover">
<i class="fa-fw fas fa-language"></i>
{{ partial "language-selector.html" . }}
</a>
</li>
{{ if hugo.IsMultilingual }}
<li class="nav-item mt-4">
<a class="nav-link no-hover">
<i class="fa-fw fas fa-language"></i>
{{ partial "language-selector.html" . }}
</a>
</li>
{{ end }}
</ul>
</nav>
@ -66,6 +69,8 @@
{{ $url = printf "mailto:%s" .id }}
{{ else if eq .type "rss" }}
{{ $url = "index.xml" | absLangURL }}
{{ else if eq .type "custom" }}
{{ $url = printf "%s" .id }}
{{ else }}
{{ $url = .url }}
{{ 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,8 +9,10 @@
<!-- get all parent categories -->
{{ $parentCategories := slice }}
{{ range $allPages }}
{{ if gt (len .Params.categories) 0 }}
{{ $parentCategories = $parentCategories | append (index .Params.categories 0) }}
{{ if isset .Params "categories" }}
{{ if gt (len .Params.categories) 0 }}
{{ $parentCategories = $parentCategories | append (index .Params.categories 0) }}
{{ end }}
{{ end }}
{{ end }}
{{ $parentCategories = $parentCategories | uniq | sort }}
@ -23,11 +25,13 @@
<!-- get all pages and subcategories related to the parent category -->
{{ range $allPages }}
{{ if gt (len .Params.categories) 0 }}
{{ if eq (index .Params.categories 0) $parentName }}
{{ $parentPages = $parentPages | append . }}
{{ if gt (len .Params.categories) 1 }}
{{ $subcategories = $subcategories | append (index .Params.categories 1) }}
{{ if isset .Params "categories" }}
{{ if gt (len .Params.categories) 0 }}
{{ if eq (index .Params.categories 0) $parentName }}
{{ $parentPages = $parentPages | append . }}
{{ if gt (len .Params.categories) 1 }}
{{ $subcategories = $subcategories | append (index .Params.categories 1) }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}