Compare commits
12 Commits
125b381c04
...
main
Author | SHA1 | Date | |
---|---|---|---|
98acc1f743 | |||
02da26940c | |||
a54226801c | |||
5392098d00 | |||
508f8ed841 | |||
83d24c4127 | |||
f06f188d38 | |||
7973ebbf9d | |||
5e13298a65 | |||
c58e328fe7 | |||
37bb9cb449 | |||
58c79a5381 |
58
README.md
58
README.md
@ -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]
|
||||
|
||||
[][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
|
@ -1,15 +1,13 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
MathJax = {
|
||||
tex: {
|
||||
inlineMath: [
|
||||
['$', '$'],
|
||||
['\\(', '\\)']
|
||||
],
|
||||
displayMath: [
|
||||
['$$', '$$'],
|
||||
['\\[', '\\]']
|
||||
],
|
||||
tags: 'ams'
|
||||
}
|
||||
};
|
||||
});
|
||||
window.MathJax = {
|
||||
tex: {
|
||||
inlineMath: [
|
||||
['$', '$'],
|
||||
['\\(', '\\)']
|
||||
],
|
||||
displayMath: [
|
||||
['$$', '$$'],
|
||||
['\\[', '\\]']
|
||||
],
|
||||
tags: 'ams'
|
||||
}
|
||||
};
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
title: Test 2
|
||||
date: 2025-04-11 00:34:00 +0800
|
||||
description: >-
|
||||
Test 2
|
||||
---
|
6
exampleSite/content/post/tutorials/python/python-test.md
Normal file
6
exampleSite/content/post/tutorials/python/python-test.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
title: Test 3
|
||||
date: 2025-04-11 00:34:00 +0800
|
||||
description: >-
|
||||
Test 3
|
||||
---
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
title: Test 4
|
||||
date: 2025-04-11 00:34:00 +0800
|
||||
description: >-
|
||||
Test 4
|
||||
---
|
8
exampleSite/content/post/tutorials/test1.en.md
Normal file
8
exampleSite/content/post/tutorials/test1.en.md
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
title: Test 1
|
||||
date: 2025-04-11 00:34:00 +0800
|
||||
description: >-
|
||||
Test 1
|
||||
---
|
||||
|
||||
123
|
7
go.mod
7
go.mod
@ -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
6
go.sum
@ -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=
|
||||
|
@ -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 = "."
|
||||
|
@ -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 }}
|
||||
|
||||
|
@ -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 -}}
|
||||
|
@ -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 -->
|
||||
|
@ -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 }}
|
@ -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
50
layouts/section/list.html
Normal 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 }}
|
@ -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 }}
|
||||
|
Reference in New Issue
Block a user