Compare commits

..

28 Commits

Author SHA1 Message Date
Jimmy Cai
9e6b7b22a9 release: 3.30.0 2025-01-23 22:55:27 +01:00
Jimmy
f1ab6c6aba
fix(giscus): no longer use $.Language.LanguageCode for the language of Giscus (#1118)
fix(giscus): rollback https://github.com/CaiJimmy/hugo-theme-stack/pull/1075

User can still customize the language used for Giscus using `.Site.Params.comments.giscus.lang` parameter.
2025-01-23 22:54:37 +01:00
Hamza
087989e427
chore(i18n): fix a tiny typo in the footer (#1099) 2024-12-22 14:53:10 +01:00
fsj2009yx
0991f61d49
fix(comment/waline): cannot read property ‘insertBefore’ of null (#1103)
* fix: resolve issue with comments not displaying due to KaTeX and Waline render order

* Fix the problem that comment data couldn't be pulled successfully and raise Error "Cannot read property ‘insertBefore’ of null""
2024-12-22 12:44:13 +01:00
Jimmy Cai
839fbd0ecb release: 3.29.0 2024-10-20 08:05:45 +00:00
Jimmy Cai
5175ac5ae3
fix(giscus): fallback to en if no language code is set (#1084) 2024-10-20 10:04:59 +02:00
Jimmy Cai
37f1541c20
feat: search box in 404 page (#1081) 2024-10-20 00:26:59 +02:00
Jimmy Cai
f4eb5d3e99 release: 3.28.0 2024-10-19 21:32:49 +00:00
xiaoxiyao
788dd497b3
feat: add fingerprints to the JS file URL to utilize HTTP caching (#1076) 2024-10-19 21:14:35 +02:00
xiaoxiyao
8a7fb33163
feat(giscus): use current language as fallback for lang param and add loading param (#1075)
fix: giscus use current lang as default, and add missing `loading` params
2024-10-19 20:46:27 +02:00
onavas33
2a18a92901
fix(i18n): missing translation for title of categories widget in fr.yaml (#1059) 2024-10-06 19:33:20 +02:00
PukNgae Cryolitia
245b0f2810
fix(colorScheme): systemPreferScheme not initialized on start up (#1061) 2024-10-06 19:32:13 +02:00
Jimmy Cai
0fb25c808b
fix: show different subtitle for each i18n variant in exampleSite (#1068) 2024-10-06 19:17:40 +02:00
Jimmy Cai
048a000f17 release: 3.27.0 2024-09-07 18:57:23 +02:00
Jimmy Cai
5f157478aa
fix(exampleSite): site config key paginate was deprecated (#1057)
fix: site config key paginate was deprecated
2024-09-07 18:51:18 +02:00
Jimmy Cai
8556681b7c
doc: add markup.goldmark.extensions.passthrough in exampleSite (#1056)
Related: https://github.com/CaiJimmy/hugo-theme-stack/issues/1019
2024-09-07 18:47:15 +02:00
powerfullz
fa760d70cb
fix: use css.Sass instead of deprecated resources.ToCSS (#1054) 2024-09-07 18:42:07 +02:00
Syafa Adena
bdcab89d86
chore: bump Twikoo front-end to latest released version 1.6.39 (#1021) 2024-09-07 18:14:57 +02:00
saikadaramakaisosjupita
b3907acdae
doc: add backslash to baseURL in exampleSite (#1009) 2024-09-07 17:59:59 +02:00
Vladimir Vitkov
23ff70d41a
feat(i18n): add Bulgarian translations (#1007) 2024-09-07 17:56:17 +02:00
ensag-dev
41a3e5ee13
feat(i18n): add Occitan translations (#1034) 2024-09-07 17:52:40 +02:00
DashJay
0558108e30
feat(comments): add support to Gitalk proxy parameter (#1012)
Co-authored-by: Jimmy Cai <hi@jimmycai.com>
2024-09-07 17:18:03 +02:00
Anthony Simmon
12f31dfd8a
fix: use Hugo's default RSS template value source for lastBuildDate (#1006)
Use Hugo's default RSS template value source for lastBuildDate
2024-09-07 14:22:17 +02:00
weeix
374b25a60f
fix(i18n): fix unlocalized article publish/lastUpdated date (#1050)
closes https://github.com/CaiJimmy/hugo-theme-stack/issues/1040
2024-09-07 13:48:09 +02:00
Jimmy Cai
fcd56dd21c
fix: article category overflow (#1055)
closes https://github.com/CaiJimmy/hugo-theme-stack/issues/1045
2024-09-07 13:25:26 +02:00
Jimmy Cai
fddab05362 release: 3.26.0 2024-05-02 23:28:01 +02:00
Jimmy Cai
f3783856ad
feat: add article.headingAnchor parameter and use CSS pseudo-element to display # symbol of heading anchor (#1016)
* feat: add `article.headingAnchor` parameter

* feat: use CSS pseudo-element to display `#` symbol of heading anchor

This prevents RSS feed readers and screen readers from seeing an extra `#`.

* Deactivate `article.headingAnchor` by default
2024-05-02 23:27:17 +02:00
Jimmy Cai
130e2f6607
feat: display header anchor on hover (#999) 2024-03-30 23:22:18 +01:00
23 changed files with 264 additions and 21 deletions

View File

@ -131,6 +131,7 @@
.article-tags { .article-tags {
display: flex; display: flex;
gap: 10px; gap: 10px;
flex-wrap: wrap;
a { a {
color: var(--accent-color-text); color: var(--accent-color-text);

View File

@ -67,7 +67,6 @@
} }
.article-tags { .article-tags {
flex-wrap: wrap;
text-transform: unset; text-transform: unset;
} }
@ -222,6 +221,28 @@
margin-inline-start: calc((var(--card-padding)) * -1); margin-inline-start: calc((var(--card-padding)) * -1);
padding-inline-start: calc(var(--card-padding) - var(--heading-border-size)); padding-inline-start: calc(var(--card-padding) - var(--heading-border-size));
border-inline-start: var(--heading-border-size) solid var(--accent-color); border-inline-start: var(--heading-border-size) solid var(--accent-color);
position: relative;
a.header-anchor {
transition: opacity 0.3s ease;
opacity: 0;
position: absolute;
left: 0;
width: var(--card-padding);
text-align: center;
color: var(--accent-color);
&:before {
content: "#";
}
}
&:hover,
&:focus {
a.header-anchor {
opacity: 1;
}
}
} }
figure { figure {

View File

@ -8,6 +8,10 @@ class StackColorScheme {
constructor(toggleEl: HTMLElement) { constructor(toggleEl: HTMLElement) {
this.bindMatchMedia(); this.bindMatchMedia();
this.currentScheme = this.getSavedScheme(); this.currentScheme = this.getSavedScheme();
if (window.matchMedia('(prefers-color-scheme: dark)').matches === true)
this.systemPreferScheme = 'dark'
else
this.systemPreferScheme = 'light';
this.dispatchEvent(document.documentElement.dataset.scheme as colorScheme); this.dispatchEvent(document.documentElement.dataset.scheme as colorScheme);

View File

@ -53,7 +53,14 @@ class Search {
this.resultTitle = resultTitle; this.resultTitle = resultTitle;
this.resultTitleTemplate = resultTitleTemplate; this.resultTitleTemplate = resultTitleTemplate;
/// Check if there's already value in the search input
if (this.input.value.trim() !== '') {
this.doSearch(this.input.value.split(' '));
}
else {
this.handleQueryString(); this.handleQueryString();
}
this.bindQueryStringChange(); this.bindQueryStringChange();
this.bindSearchForm(); this.bindSearchForm();
} }

View File

@ -28,6 +28,7 @@ params:
src: img/avatar.png src: img/avatar.png
article: article:
headingAnchor: false
math: false math: false
toc: true toc: true
readingTime: true readingTime: true

View File

@ -1,7 +1,6 @@
baseurl: https://example.com baseurl: https://example.com/
languageCode: en-us languageCode: en-us
theme: hugo-theme-stack theme: hugo-theme-stack
paginate: 3
title: Example Site title: Example Site
copyright: Example Person copyright: Example Person
@ -19,20 +18,23 @@ languages:
title: Example Site title: Example Site
weight: 1 weight: 1
params: params:
description: Example description sidebar:
subtitle: Example description
zh-cn: zh-cn:
languageName: 中文 languageName: 中文
title: 演示站点 title: 演示站点
weight: 2 weight: 2
params: params:
description: 演示说明 sidebar:
subtitle: 演示说明
ar: ar:
languageName: عربي languageName: عربي
languagedirection: rtl languagedirection: rtl
title: موقع تجريبي title: موقع تجريبي
weight: 3 weight: 3
params: params:
description: وصف تجريبي sidebar:
subtitle: وصف تجريبي
services: services:
# Change it to your Disqus shortname before using # Change it to your Disqus shortname before using
@ -42,6 +44,9 @@ services:
googleAnalytics: googleAnalytics:
id: id:
pagination:
pagerSize: 3
permalinks: permalinks:
post: /p/:slug/ post: /p/:slug/
page: /:slug/ page: /:slug/
@ -156,6 +161,7 @@ params:
repo: repo:
clientID: clientID:
clientSecret: clientSecret:
proxy:
cusdis: cusdis:
host: host:
@ -234,6 +240,18 @@ related:
markup: markup:
goldmark: goldmark:
extensions:
passthrough:
enable: true
delimiters:
block:
- - \[
- \]
- - $$
- $$
inline:
- - \(
- \)
renderer: renderer:
## Set to true if you have HTML content inside Markdown ## Set to true if you have HTML content inside Markdown
unsafe: true unsafe: true

View File

@ -68,7 +68,7 @@ search:
footer: footer:
builtWith: builtWith:
other: "مبني بستخدام {{ .Generator }}" other: "مبني باستخدام {{ .Generator }}"
designedBy: designedBy:
other: "قالب {{ .Theme }} مصمم من {{ .DesignedBy }}" other: "قالب {{ .Theme }} مصمم من {{ .DesignedBy }}"

73
i18n/bg.yaml Normal file
View File

@ -0,0 +1,73 @@
toggleMenu:
other: Покажи Меню
darkMode:
other: Тъмен Режим
list:
page:
one: "{{ .Count }} страница"
other: "{{ .Count }} страници"
section:
other: Секция
subsection:
one: Подсекция
other: Подсекции
article:
back:
other: Назад
tableOfContents:
other: Съдържание
relatedContent:
other: Свързано Съдържание
lastUpdatedOn:
other: Последна промяна на
readingTime:
one: "{{ .Count }} minute read"
other: "{{ .Count }} minute read"
notFound:
title:
other: Не е намерено
subtitle:
other: Страницата която търсите не е открита
widget:
archives:
title:
other: Архиви
more:
other: Повече
tagCloud:
title:
other: Тагове
categoriesCloud:
title:
other: Категории
search:
title:
other: Търсене
placeholder:
other: Напишете нещо...
resultTitle:
other: "#PAGES_COUNT страници (#TIME_SECONDS секунди)"
footer:
builtWith:
other: Създадено с {{ .Generator }}
designedBy:
other: Тема {{ .Theme }} създадена от {{ .DesignedBy }}

View File

@ -50,6 +50,9 @@ widget:
tagCloud: tagCloud:
title: title:
other: Mots clés other: Mots clés
categoriesCloud:
title:
other: Catégories
search: search:
title: title:

72
i18n/oc.yaml Normal file
View File

@ -0,0 +1,72 @@
toggleMenu:
other: Alternar menú
darkMode:
other: Mòde fosc
list:
page:
one: "{{ .Count }} pagina"
other: "{{ .Count }} paginas"
section:
other: Seccion
subsection:
one: Josseccion
other: Josseccions
article:
back:
other: Tornar
tableOfContents:
other: Taula de contengut
relatedContent:
other: Contenguts relacionats
lastUpdatedOn:
other: Darrièra actualizacion
readingTime:
one: "{{ .Count }} minuta de lectura"
other: "{{ .Count }} minutas de lectura"
notFound:
title:
other: Non trobat
subtitle:
other: Aquesta pagina existís pas
widget:
archives:
title:
other: Archiu
more:
other: Mai
tagCloud:
title:
other: Etiquetas
categoriesCloud:
title:
other: Categorias
search:
title:
other: Cercar
placeholder:
other: Picatz quicòm...
resultTitle:
other: "#PAGES_COUNT paginas dins (#TIME_SECONDS segons)"
footer:
builtWith:
other: Creat amb {{ .Generator }}
designedBy:
other: Tàma {{ .Theme }} concebut per {{ .DesignedBy }}

View File

@ -3,5 +3,43 @@
<h1 class="article-title">{{ T "notFound.title" }}</h1> <h1 class="article-title">{{ T "notFound.title" }}</h1>
<h2 class="article-subtitle">{{ T "notFound.subtitle" }}</h2> <h2 class="article-subtitle">{{ T "notFound.subtitle" }}</h2>
</div> </div>
{{- $query := first 1 (where .Site.Pages "Layout" "==" "search") -}}
{{- $searchPage := index $query 0 -}}
{{- with $searchPage -}}
<form action="{{ $searchPage.RelPermalink }}" class="search-form widget" {{ with .OutputFormats.Get "json" -}}data-json="{{ .Permalink }}" {{- end }}>
<p>
<label>{{ T "search.title" }}</label>
<input id="searchInput" name="keyword" required placeholder="{{ T `search.placeholder` }}" />
<button title="{{ T `search.title` }}">
{{ partial "helper/icon" "search" }}
</button>
</p>
</form>
<div class="search-result">
<h3 class="search-result--title section-title"></h3>
<div class="search-result--list article-list--compact"></div>
</div>
<script>
window.searchResultTitleTemplate = "{{ T `search.resultTitle` }}"
</script>
{{- $opts := dict "minify" hugo.IsProduction "JSXFactory" "createElement" -}}
{{- $searchScript := resources.Get "ts/search.tsx" | js.Build $opts -}}
<script type="text/javascript" src="{{ $searchScript.RelPermalink }}" defer></script>
<script>
const wrongUrl = new URL(window.location.href);
/// Get the search keyword from the wrong URL by removing all slashes and dashes
const searchKeyword = wrongUrl.pathname.split(/[/|-]/).join(' ').trim();
document.getElementById('searchInput').setAttribute('value', searchKeyword);
</script>
{{- end -}}
{{ partialCached "footer/footer" . }} {{ partialCached "footer/footer" . }}
{{ end }} {{ end }}

View File

@ -1,4 +1,6 @@
<h{{ .Level }} id="{{ .Anchor }}"> <h{{ .Level }} id="{{ .Anchor }}">
<a href="#{{ .Anchor }}">#</a> {{- if site.Params.Article.HeadingAnchor -}}
<a href="#{{ .Anchor }}" class="header-anchor"></a>
{{- end -}}
{{ .Text | safeHTML }} {{ .Text | safeHTML }}
</h{{ .Level }}> </h{{ .Level }}>

View File

@ -22,7 +22,7 @@
<managingEditor>{{.}}{{ with $.Site.Params.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Params.Author.email }} <managingEditor>{{.}}{{ with $.Site.Params.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Params.Author.email }}
<webMaster>{{.}}{{ with $.Site.Params.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }} <webMaster>{{.}}{{ with $.Site.Params.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} <lastBuildDate>{{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{- with .OutputFormats.Get "RSS" -}} {{- with .OutputFormats.Get "RSS" -}}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end -}} {{- end -}}

View File

@ -32,7 +32,7 @@
<div> <div>
{{ partial "helper/icon" "date" }} {{ partial "helper/icon" "date" }}
<time class="article-time--published"> <time class="article-time--published">
{{- .Date.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") -}} {{- .Date | time.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") -}}
</time> </time>
</div> </div>
{{ end }} {{ end }}

View File

@ -12,7 +12,7 @@
<section class="article-lastmod"> <section class="article-lastmod">
{{ partial "helper/icon" "clock" }} {{ partial "helper/icon" "clock" }}
<span> <span>
{{ T "article.lastUpdatedOn" }} {{ .Lastmod.Format ( or .Site.Params.dateFormat.lastUpdated "Jan 02, 2006 15:04 MST" ) }} {{ T "article.lastUpdatedOn" }} {{ .Lastmod | time.Format ( or .Site.Params.dateFormat.lastUpdated "Jan 02, 2006 15:04 MST" ) }}
</span> </span>
</section> </section>
{{- end -}} {{- end -}}

View File

@ -1,7 +1,8 @@
{{- partial "helper/external" (dict "Context" . "Namespace" "KaTeX") -}} {{- partial "helper/external" (dict "Context" . "Namespace" "KaTeX") -}}
<script> <script>
window.addEventListener("DOMContentLoaded", () => { window.addEventListener("DOMContentLoaded", () => {
renderMathInElement(document.body, { const mainArticleElement = document.querySelector(".main-article");
renderMathInElement(mainArticleElement, {
delimiters: [ delimiters: [
{ left: "$$", right: "$$", display: true }, { left: "$$", right: "$$", display: true },
{ left: "$", right: "$", display: false }, { left: "$", right: "$", display: false },

View File

@ -2,7 +2,7 @@
{{- $disqusjs := .Site.Params.Comments.disqusjs -}} {{- $disqusjs := .Site.Params.Comments.disqusjs -}}
{{- if and (not $pc.Disable) (and $disqusjs.Shortname $disqusjs.ApiKey) -}} {{- if and (not $pc.Disable) (and $disqusjs.Shortname $disqusjs.ApiKey) -}}
{{- $style := resources.Get "scss/partials/comments/disqusjs.scss" | resources.ToCSS | minify -}} {{- $style := resources.Get "scss/partials/comments/disqusjs.scss" | toCSS | minify -}}
<link rel="stylesheet" href="{{ $style.RelPermalink }}"> <link rel="stylesheet" href="{{ $style.RelPermalink }}">
<div class="disqus-container"> <div class="disqus-container">

View File

@ -12,6 +12,7 @@
data-input-position="{{- default `top` .inputPosition -}}" data-input-position="{{- default `top` .inputPosition -}}"
data-theme="{{- default `light` .lightTheme -}}" data-theme="{{- default `light` .lightTheme -}}"
data-lang="{{- default `en` .lang -}}" data-lang="{{- default `en` .lang -}}"
data-loading="{{- .loading -}}"
crossorigin="anonymous" crossorigin="anonymous"
async async
></script> ></script>

View File

@ -15,6 +15,7 @@
admin: ["{{- .admin -}}"], admin: ["{{- .admin -}}"],
distractionFreeMode: false, // Facebook-like distraction free mode distractionFreeMode: false, // Facebook-like distraction free mode
id: md5(location.pathname), // Max Location.pathname Legth:75 https://github.com/gitalk/gitalk/issues/102 id: md5(location.pathname), // Max Location.pathname Legth:75 https://github.com/gitalk/gitalk/issues/102
proxy: {{- .proxy -}},
}); });
(function () { (function () {
if ( if (

View File

@ -1,4 +1,4 @@
<script src="//cdn.jsdelivr.net/npm/twikoo@1.6.21/dist/twikoo.all.min.js"></script> <script src="//cdn.jsdelivr.net/npm/twikoo@1.6.39/dist/twikoo.all.min.js"></script>
<div id="tcomment"></div> <div id="tcomment"></div>
<style> <style>
.twikoo { .twikoo {

View File

@ -1,12 +1,12 @@
{{- partial "helper/external" (dict "Context" . "Namespace" "Vibrant") -}} {{- partial "helper/external" (dict "Context" . "Namespace" "Vibrant") -}}
{{- $opts := dict "minify" hugo.IsProduction -}} {{- $opts := dict "minify" hugo.IsProduction -}}
{{- $script := resources.Get "ts/main.ts" | js.Build $opts -}} {{- $script := resources.Get "ts/main.ts" | js.Build $opts | fingerprint -}}
<script type="text/javascript" src="{{ $script.RelPermalink }}" defer></script> <script type="text/javascript" src="{{ $script.RelPermalink }}" defer></script>
{{- with resources.Get "ts/custom.ts" -}} {{- with resources.Get "ts/custom.ts" -}}
{{/* Place your custom script in HUGO_SITE_FOLDER/assets/ts/custom.ts */}} {{/* Place your custom script in HUGO_SITE_FOLDER/assets/ts/custom.ts */}}
{{- $customScript := . | js.Build $opts -}} {{- $customScript := . | js.Build $opts | fingerprint -}}
<script type="text/javascript" src="{{ $customScript.RelPermalink }}" defer></script> <script type="text/javascript" src="{{ $customScript.RelPermalink }}" defer></script>
{{- end -}} {{- end -}}

View File

@ -1,4 +1,4 @@
{{- $ThemeVersion := "3.25.0" -}} {{- $ThemeVersion := "3.30.0" -}}
<footer class="site-footer"> <footer class="site-footer">
<section class="copyright"> <section class="copyright">
&copy; &copy;

View File

@ -1,3 +1,3 @@
{{ $sass := resources.Get "scss/style.scss" }} {{ $sass := resources.Get "scss/style.scss" }}
{{ $style := $sass | resources.ToCSS | minify | resources.Fingerprint "sha256" }} {{ $style := $sass | toCSS | minify | resources.Fingerprint "sha256" }}
<link rel="stylesheet" href="{{ $style.RelPermalink }}"> <link rel="stylesheet" href="{{ $style.RelPermalink }}">