Prepare for Docker Deploy

This commit is contained in:
FlintyLemming
2026-01-19 11:22:22 +08:00
parent 9003d8863e
commit de825f91ac
61 changed files with 557 additions and 127 deletions

View File

@@ -2,7 +2,8 @@ baseURL: https://blog.mitsea.com/
languageCode: zh-cn languageCode: zh-cn
title: Mitsea Blog title: Mitsea Blog
theme: hugo-theme-stack theme: hugo-theme-stack
paginate: 10 pagination:
pagerSize: 10
languages: languages:
zh-cn: zh-cn:

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-left"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M15 6l-6 6l6 6" /></svg>

After

Width:  |  Height:  |  Size: 336 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-chevron-right"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 6l6 6l-6 6" /></svg>

After

Width:  |  Height:  |  Size: 336 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-dots"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M5 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /><path d="M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /><path d="M19 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0" /></svg>

After

Width:  |  Height:  |  Size: 459 B

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

@@ -12,6 +12,9 @@ body {
margin: 0; margin: 0;
font-family: var(--base-font-family); font-family: var(--base-font-family);
font-size: 1.6rem; font-size: 1.6rem;
text-autospace: ideograph-alpha ideograph-numeric punctuation insert;
text-spacing-trim: trim-start allow-end;
-ms-text-autospace: ideograph-alpha;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }

View File

@@ -67,7 +67,6 @@
} }
.article-tags { .article-tags {
flex-wrap: wrap;
text-transform: unset; text-transform: unset;
} }

View File

@@ -33,6 +33,7 @@
img { img {
width: 60px; width: 60px;
height: 60px; height: 60px;
object-fit: cover;
} }
} }
@@ -47,10 +48,12 @@
.subsection-list { .subsection-list {
overflow-x: auto; overflow-x: auto;
margin-left: -24px;
.article-list--tile { .article-list--tile {
display: flex; display: flex;
padding-bottom: 15px; padding: 8px 0 34px 24px;
width: max-content;
article { article {
width: 250px; width: 250px;

View File

@@ -4,18 +4,47 @@
box-shadow: var(--shadow-l1); box-shadow: var(--shadow-l1);
border-radius: var(--card-border-radius); border-radius: var(--card-border-radius);
overflow: hidden; overflow: hidden;
flex-wrap: wrap;
.page-link { .page-link {
padding: 16px 32px; padding: 16px 0;
display: inline-flex; margin: 0;
border-radius: 0;
display: flex;
align-items: center;
justify-content: center;
flex: 1 1 auto;
min-width: 48px;
color: var(--card-text-color-secondary);
text-decoration: none;
&:first-child,
&:last-child {
flex: 0 0 48px;
padding: 16px;
}
&:hover:not(.current):not(.disabled) {
background-color: var(--card-background-selected);
opacity: 0.8;
}
&.current { &.current {
font-weight: bold;
background-color: var(--card-background-selected); background-color: var(--card-background-selected);
color: var(--card-text-color-main); color: var(--card-text-color-main);
font-weight: bold;
cursor: default;
} }
&.disabled {
opacity: 0.3;
cursor: not-allowed;
pointer-events: none;
color: var(--card-text-color-secondary); color: var(--card-text-color-secondary);
} }
svg {
width: 20px;
height: 20px;
}
}
} }

View File

@@ -41,10 +41,8 @@ $defaultTagColors: #fff, #fff, #fff, #fff, #fff;
*/ */
:root { :root {
--sys-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Droid Sans", "Helvetica Neue"; --sys-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Droid Sans", "Helvetica Neue";
--zh-font-family: "PingFang SC", "Hiragino Sans GB", "Droid Sans Fallback", "Microsoft YaHei"; --base-font-family: "Lato", var(--sys-font-family), sans-serif;
--code-font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
--base-font-family: "Lato", var(--sys-font-family), var(--zh-font-family), sans-serif;
--code-font-family: Menlo, Monaco, Consolas, "Courier New", var(--zh-font-family), monospace;
} }
/* /*

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

@@ -32,10 +32,12 @@ function buildIdToNavigationElementMap(navigation: NodeListOf<Element>): IdToEle
const sectionLinkRef: IdToElementMap = {}; const sectionLinkRef: IdToElementMap = {};
navigation.forEach((navigationElement: HTMLElement) => { navigation.forEach((navigationElement: HTMLElement) => {
const link = navigationElement.querySelector("a"); const link = navigationElement.querySelector("a");
if (link) {
const href = link.getAttribute("href"); const href = link.getAttribute("href");
if (href.startsWith("#")) { if (href.startsWith("#")) {
sectionLinkRef[href.slice(1)] = navigationElement; sectionLinkRef[href.slice(1)] = navigationElement;
} }
}
}); });
return sectionLinkRef; return sectionLinkRef;
@@ -125,6 +127,13 @@ function setupScrollspy() {
scrollHandler(); scrollHandler();
} }
// Use ResizeObserver to detect changes in the size of .article-content
const articleContent = document.querySelector(".article-content");
if (articleContent) {
const resizeObserver = new ResizeObserver(debounced(resizeHandler));
resizeObserver.observe(articleContent);
}
window.addEventListener("resize", debounced(resizeHandler)); window.addEventListener("resize", debounced(resizeHandler));
} }

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

@@ -0,0 +1,8 @@
---
menu:
main:
name: ホーム
weight: -100
params:
icon: home
---

View File

@@ -0,0 +1,8 @@
---
menu:
main:
name: 主頁
weight: -100
params:
icon: home
---

View File

@@ -0,0 +1,26 @@
---
title: Japanese Test
description: これはサブタイトル
date: 2020-09-09
slug: test-chinese
image: helena-hertz-wWZzXlDpMog-unsplash.jpg
categories:
- Test
- テスト
---
## 本文テスト(フォント)
返扇花週認契適違込遷雇述請曜藤突扉直角
## 引用
> 国破れて山河在り\
> 城春にして草木深し\
> 時に感じては花にも涙を濺ぎ\
> 別れを恨んでは鳥にも心を驚かす
>
> 烽火三月に連なり\
> 家書万金に抵たる\
> 白頭掻けば更に短く\
> 渾べて簪に勝へざらんと欲す

View File

@@ -37,3 +37,7 @@ categories:
``` ```
相册语法来自 [Typlog](https://typlog.com/) 相册语法来自 [Typlog](https://typlog.com/)
## 字体
返扇花週認契適違込遷雇述請曜藤突扉直角

View File

@@ -0,0 +1,14 @@
---
title: Chinese Test
description: 這是一個副標題
date: 2020-09-09
slug: test-chinese
image: helena-hertz-wWZzXlDpMog-unsplash.jpg
categories:
- Test
- 測試
---
## 正文測試(字體)
返扇花週認契適違込遷雇述請曜藤突扉直角

View File

@@ -21,7 +21,7 @@ To enable emoji globally, set `enableEmoji` to `true` in your site's [configurat
<p><span class="nowrap"><span class="emojify">🙈</span> <code>:see_no_evil:</code></span> <span class="nowrap"><span class="emojify">🙉</span> <code>:hear_no_evil:</code></span> <span class="nowrap"><span class="emojify">🙊</span> <code>:speak_no_evil:</code></span></p> <p><span class="nowrap"><span class="emojify">🙈</span> <code>:see_no_evil:</code></span> <span class="nowrap"><span class="emojify">🙉</span> <code>:hear_no_evil:</code></span> <span class="nowrap"><span class="emojify">🙊</span> <code>:speak_no_evil:</code></span></p>
<br> <br>
The [Emoji cheat sheet](http://www.emoji-cheat-sheet.com/) is a useful reference for emoji shorthand codes. The [Emoji cheat sheet](https://www.webfx.com/tools/emoji-cheat-sheet/) is a useful reference for emoji shorthand codes.
*** ***

View File

@@ -21,9 +21,9 @@ Hugo ships with several [Built-in Shortcodes](https://gohugo.io/content-manageme
--- ---
## Twitter Simple Shortcode ## X Simple Shortcode
{{< twitter_simple user="DesignReviewed" id="1085870671291310081" >}} {{< x user="DesignReviewed" id="1085870671291310081" >}}
<br> <br>
@@ -37,10 +37,6 @@ Hugo ships with several [Built-in Shortcodes](https://gohugo.io/content-manageme
{{< bilibili av498363026 >}} {{< bilibili av498363026 >}}
## Gist Shortcode
{{< gist spf13 7896402 >}}
## Gitlab Snippets Shortcode ## Gitlab Snippets Shortcode
{{< gitlab 2349278 >}} {{< gitlab 2349278 >}}

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,39 @@ 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: 演示说明
zh-tw:
languageName: 正體中文
title: 演示站點
weight: 2
params:
sidebar:
subtitle: 演示說明
ja:
languageName: 日本語
title: サンプルサイト
weight: 2
params:
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 +60,9 @@ services:
googleAnalytics: googleAnalytics:
id: id:
pagination:
pagerSize: 3
permalinks: permalinks:
post: /p/:slug/ post: /p/:slug/
page: /:slug/ page: /:slug/
@@ -156,6 +177,7 @@ params:
repo: repo:
clientID: clientID:
clientSecret: clientSecret:
proxy:
cusdis: cusdis:
host: host:
@@ -234,6 +256,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

@@ -11,8 +11,8 @@ params:
favicon: favicon:
footer: footer:
since: 2018 since:
customText: <a href="https://beian.miit.gov.cn/">皖ICP备19023860号</a> customText:
dateFormat: dateFormat:
published: Jan 02, 2006 published: Jan 02, 2006
@@ -25,7 +25,7 @@ params:
avatar: avatar:
enabled: true enabled: true
local: true local: true
src: img/avatar.jpeg src: img/avatar.png
article: article:
headingAnchor: false headingAnchor: false

View File

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

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:

View File

@@ -2,7 +2,7 @@ toggleMenu:
other: Toggle Menu other: Toggle Menu
darkMode: darkMode:
other: Dark Mode other: Modalità scura
list: list:
page: page:
@@ -49,7 +49,7 @@ widget:
tagCloud: tagCloud:
title: title:
other: Tags other: Tag
categoriesCloud: categoriesCloud:
title: title:

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

@@ -47,6 +47,9 @@ widget:
tagCloud: tagCloud:
title: title:
other: Теги other: Теги
categoriesCloud:
title:
other: Категории
search: search:
title: title:

View File

@@ -17,11 +17,22 @@ list:
other: Alt bölümler other: Alt bölümler
article: article:
back:
other: Geri
tableOfContents:
other: İçindekiler
relatedContent: relatedContent:
other: Alakalı içerikler other: Benzer içerikler
lastUpdatedOn: lastUpdatedOn:
other: Son güncelleme other: Son güncelleme
readingTime:
one: "{{ .Count }} dakika okuma süresi"
other: "{{ .Count }} dakika okuma süresi"
notFound: notFound:
title: title:
other: Bulunamadı other: Bulunamadı
@@ -37,6 +48,9 @@ widget:
tagCloud: tagCloud:
title: title:
other: Etiketler other: Etiketler
categoriesCloud:
title:
other: Kategoriler
search: search:
title: title:

View File

@@ -52,6 +52,9 @@ widget:
tagCloud: tagCloud:
title: title:
other: Теґи other: Теґи
categoriesCloud:
title:
other: Категорії
search: search:
title: title:

View File

@@ -31,7 +31,7 @@ notFound:
title: title:
other: 404 错误 other: 404 错误
subtitle: subtitle:
other: 页面不存在。你可以尝试将链接中的 https://blog.mitsea.com/ 替换为 https://www.notion.so/flintylemming/ 查看原档。 other: 页面不存在
widget: widget:
archives: archives:

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 = decodeURIComponent(wrongUrl.pathname).split(/[/|-]/).join(' ').trim();
document.getElementById('searchInput').setAttribute('value', searchKeyword);
</script>
{{- end -}}
{{ partialCached "footer/footer" . }} {{ partialCached "footer/footer" . }}
{{ end }} {{ end }}

View File

@@ -0,0 +1,4 @@
<pre class="mermaid">
{{ .Inner | htmlEscape | safeHTML }}
</pre>
{{ .Page.Store.Set "hasMermaid" true }}

View File

@@ -4,7 +4,7 @@
{{- $taxonomy := $.Site.GetPage "taxonomyTerm" "categories" -}} {{- $taxonomy := $.Site.GetPage "taxonomyTerm" "categories" -}}
{{- $terms := $taxonomy.Pages -}} {{- $terms := $taxonomy.Pages -}}
{{ if $terms }} {{ if $terms }}
<h2 class="section-title">{{ $taxonomy.Title }}</h2> <h2 class="section-title">{{ T "widget.categoriesCloud.title" }}</h2>
<div class="subsection-list"> <div class="subsection-list">
<div class="article-list--tile"> <div class="article-list--tile">
{{ range $terms }} {{ range $terms }}
@@ -16,8 +16,7 @@
</header> </header>
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} {{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }} {{ $filtered := where $pages "Params.hidden" "!=" true }}
{{ $filtered := ($pages | intersect $notHidden) }}
{{ range $filtered.GroupByDate "2006" }} {{ range $filtered.GroupByDate "2006" }}
{{ $id := lower (replace .Key " " "-") }} {{ $id := lower (replace .Key " " "-") }}

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

@@ -39,6 +39,7 @@
{{ partialCached "footer/footer" . }} {{ partialCached "footer/footer" . }}
{{ partialCached "article/components/photoswipe" . }} {{ partialCached "article/components/photoswipe" . }}
{{ partialCached "article/components/mermaid" . }}
{{ end }} {{ end }}
{{ define "right-sidebar" }} {{ define "right-sidebar" }}

View File

@@ -1,7 +1,6 @@
{{ define "main" }} {{ define "main" }}
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} {{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }} {{ $filtered := where $pages "Params.hidden" "!=" true }}
{{ $filtered := ($pages | intersect $notHidden) }}
{{ $pag := .Paginate ($filtered) }} {{ $pag := .Paginate ($filtered) }}
<section class="article-list"> <section class="article-list">

View File

@@ -1,6 +1,5 @@
{{- $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}} {{- $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}}
{{- $notHidden := where .Site.RegularPages "Params.hidden" "!=" true -}} {{- $filtered := where $pages "Params.hidden" "!=" true -}}
{{- $filtered := ($pages | intersect $notHidden) -}}
{{- $result := slice -}} {{- $result := slice -}}

View File

@@ -6,7 +6,7 @@
</h2> </h2>
<footer class="article-time"> <footer class="article-time">
<time datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'> <time datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'>
{{- .Date.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") -}} {{- .Date | time.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") -}}
</time> </time>
</footer> </footer>
</div> </div>

View File

@@ -31,8 +31,8 @@
{{ if $showDate }} {{ if $showDate }}
<div> <div>
{{ partial "helper/icon" "date" }} {{ partial "helper/icon" "date" }}
<time class="article-time--published"> <time class="article-time--published" datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'>
{{- .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

@@ -21,7 +21,7 @@
{{ $permalink = .RelPermalink }} {{ $permalink = .RelPermalink }}
{{ end }} {{ end }}
<div class="article-image"> <div class="article-image">
<img src="{{ $permalink }}" loading="lazy"> <img src="{{ $permalink }}" loading="lazy"{{ with $link.alt }} alt="{{ . }}"{{ end }}>
</div> </div>
{{ end }} {{ end }}
</a> </a>

View File

@@ -1,7 +1,12 @@
{{- 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 elementsToRender = [".main-article", ".widget--toc"];
elementsToRender.forEach(selector => {
const element = document.querySelector(selector);
if (element) {
renderMathInElement(element, {
delimiters: [ delimiters: [
{ left: "$$", right: "$$", display: true }, { left: "$$", right: "$$", display: true },
{ left: "$", right: "$", display: false }, { left: "$", right: "$", display: false },
@@ -9,5 +14,8 @@
{ left: "\\[", right: "\\]", display: true } { left: "\\[", right: "\\]", display: true }
], ],
ignoredClasses: ["gist"] ignoredClasses: ["gist"]
});}) });
}
});
});
</script> </script>

View File

@@ -0,0 +1,9 @@
{{ if .Store.Get "hasMermaid" }}
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11.12.2/+esm';
mermaid.initialize({
startOnLoad: true,
theme: 'neutral',
});
</script>
{{ end }}

View File

@@ -1,20 +1,26 @@
{{- $host := default "https://cusdis.com" .Site.Params.comments.cusdis.host -}} {{- $host := default "https://cusdis.com" .Site.Params.comments.cusdis.host -}}
<div id="cusdis_thread" <div id="cusdis_thread" data-host="{{ $host }}" data-app-id="{{ .Site.Params.comments.cusdis.id }}"
data-host="{{ $host }}" data-page-id="{{ .File.UniqueID }}" data-page-url="{{ .Permalink }}" data-page-title="{{ .Title }}"></div>
data-app-id="{{ .Site.Params.comments.cusdis.id }}"
data-page-id="{{ .File.UniqueID }}"
data-page-url="{{ .Permalink }}"
data-page-title="{{ .Title }}"></div>
<script async defer src="{{ $host }}/js/cusdis.es.js"></script> <script async defer src="{{ $host }}/js/cusdis.es.js"></script>
<script> <script>
function setCusdisTheme(theme) { function setCusdisTheme(theme) {
let cusdis = document.querySelector('#cusdis_thread iframe'); let cusdis = document.querySelector('#cusdis_thread iframe');
if (cusdis) { if (cusdis) {
window.CUSDIS.setTheme(theme) window.CUSDIS.setTheme(theme);
cusdis.contentWindow.document.body.style.backgroundColor = window.getComputedStyle(document.body).backgroundColor;
} }
} }
window.addEventListener('load', function () {
let iframe = document.querySelector("#cusdis_thread iframe");
if (iframe) {
let observer = new MutationObserver(() => {
let scrollHeight = iframe.contentWindow.document.body.scrollHeight;
iframe.style.height = scrollHeight + "px";
});
observer.observe(iframe.contentWindow.document.body, { childList: true, subtree: true });
}
});
window.addEventListener('onColorSchemeChange', (e) => { window.addEventListener('onColorSchemeChange', (e) => {
setCusdisTheme(e.detail) setCusdisTheme(e.detail)
}) })

View File

@@ -1,5 +1,5 @@
<div class="disqus-container"> <div class="disqus-container">
{{ template "_internal/disqus.html" . }} {{ partial "disqus.html" . }}
</div> </div>
<style> <style>

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">
@@ -21,8 +21,12 @@
} }
function lazyLoadDisqusJS() { function lazyLoadDisqusJS() {
if (["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1) { const excludedHosts = ["localhost", "127.0.0.1"];
document.getElementById('disqus_thread').innerHTML = 'Disqus comments not available by default when the website is previewed locally.'; const hostname = window.location.hostname;
if (excludedHosts.includes(hostname)) {
document.getElementById('disqus_thread').innerHTML =
'Disqus comments not available by default when the website is previewed locally.';
return; return;
} }

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,11 +15,13 @@
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 ( const excludedHosts = ["localhost", "127.0.0.1"];
["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1 const hostname = window.location.hostname;
) {
if (excludedHosts.includes(hostname)) {
document.getElementById("gitalk-container").innerHTML = document.getElementById("gitalk-container").innerHTML =
"Gitalk comments not available by default when the website is previewed locally."; "Gitalk comments not available by default when the website is previewed locally.";
return; return;

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.44/dist/twikoo.all.min.js"></script>
<div id="tcomment"></div> <div id="tcomment"></div>
<style> <style>
.twikoo { .twikoo {
@@ -24,8 +24,11 @@
.twikoo .tk-preview-container, .twikoo .tk-preview-container,
.twikoo .tk-content, .twikoo .tk-content,
.twikoo .tk-nick, .twikoo .tk-nick,
.twikoo .tk-send { .twikoo .tk-send,
color: var(--twikoo-body-text-color-main); .twikoo .tk-comments-no,
.twikoo .el-input__count,
.twikoo .tk-submit-action-icon {
color: var(--twikoo-body-text-color-main)!important;
} }
.twikoo .el-button{ .twikoo .el-button{
color: var(--twikoo-body-text-color)!important; color: var(--twikoo-body-text-color)!important;

View File

@@ -16,7 +16,7 @@
{{- with .Site.Params.comments.waline -}} {{- with .Site.Params.comments.waline -}}
{{- $config := dict "el" "#waline" "dark" `html[data-scheme="dark"]` -}} {{- $config := dict "el" "#waline" "dark" `html[data-scheme="dark"]` -}}
{{- $replaceKeys := dict "serverurl" "serverURL" "requiredmeta" "requiredMeta" "wordlimit" "wordLimit" "pagesize" "pageSize" "imageuploader" "imageUploader" "texrenderer" "texRenderer" -}} {{- $replaceKeys := dict "serverurl" "serverURL" "requiredmeta" "requiredMeta" "wordlimit" "wordLimit" "pagesize" "pageSize" "imageuploader" "imageUploader" "texrenderer" "texRenderer" "turnstilekey" "turnstileKey" -}}
{{- range $key, $val := . -}} {{- range $key, $val := . -}}
{{- if ne $val nil -}} {{- if ne $val nil -}}

View File

@@ -6,8 +6,7 @@
<!-- Build paginator --> <!-- Build paginator -->
{{ $pages := where .Site.RegularPages "Section" "in" .Site.Params.mainSections }} {{ $pages := where .Site.RegularPages "Section" "in" .Site.Params.mainSections }}
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }} {{ $filtered := where $pages "Params.hidden" "!=" true }}
{{ $filtered := ($pages | intersect $notHidden) }}
{{ $pag := .Paginate ($filtered) }} {{ $pag := .Paginate ($filtered) }}
{{ if .Paginator.HasPrev }} {{ if .Paginator.HasPrev }}

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.26.0" -}} {{- $ThemeVersion := "3.33.0" -}}
<footer class="site-footer"> <footer class="site-footer">
<section class="copyright"> <section class="copyright">
&copy; &copy;

View File

@@ -22,5 +22,5 @@
<link rel="shortcut icon" href="{{ . | relURL }}" /> <link rel="shortcut icon" href="{{ . | relURL }}" />
{{ end }} {{ end }}
{{- template "_internal/google_analytics.html" . -}} {{- partial "google_analytics.html" . -}}
{{- partial "head/custom.html" . -}} {{- partial "head/custom.html" . -}}

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 }}">

View File

@@ -1,26 +1,70 @@
{{ if gt .Paginator.TotalPages 1 }} {{- $pag := $.Paginator -}}
<nav class='pagination'> {{- if gt $pag.TotalPages 1 -}}
{{ $.Scratch.Set "hasPrevDots" false }} <nav class="pagination" role="navigation" aria-label="pagination">
{{ $.Scratch.Set "hasNextDots" false }} {{- /* Previous page button */ -}}
<a class="page-link {{ if not $pag.Prev }}disabled{{ end }}"
{{ range .Paginator.Pagers }} {{- if $pag.Prev -}}href="{{ $pag.Prev.URL }}" {{- end -}}
{{ if eq . $.Paginator }} aria-label="Previous page"
<span class='page-link current'> {{- if not $pag.Prev -}}aria-disabled="true"{{- end -}}>
{{- .PageNumber -}} {{ partial "helper/icon" "chevron-left" }}
</span> </a>
{{ else if or (or (eq . $.Paginator.First) (eq . $.Paginator.Prev)) (or (eq . $.Paginator.Next) (eq . $.Paginator.Last )) }}
<a class='page-link' href='{{ .URL }}'> {{- /* Page numbers logic */ -}}
{{- .PageNumber -}} {{- $window := 4 -}}
{{- $showFirst := true -}}
{{- $showLast := true -}}
{{- /* First page */ -}}
<a class="page-link {{ if eq $pag.PageNumber 1 }}current{{ end }}" aria-label="Page 1"
{{- if eq $pag.PageNumber 1 -}}aria-current="page" {{- end -}}
{{- if ne $pag.PageNumber 1 -}}href="{{ $pag.First.URL }}"{{- end -}}>
1
</a>
{{- /* Left ellipsis - show if current page is > 3 */ -}}
{{- if gt $pag.PageNumber 3 -}}
<span class="page-link pagination-link">
{{ partial "helper/icon" "dots" }}
</span>
{{- end -}}
{{- /* Middle pages - show current and neighbors */ -}}
{{- range $pag.Pagers -}}
{{- if and (gt .PageNumber 1) (lt .PageNumber $pag.TotalPages) -}}
{{- if and (ge .PageNumber (sub $pag.PageNumber $window)) (le .PageNumber (add $pag.PageNumber $window)) -}}
<a class="page-link {{ if eq .PageNumber $pag.PageNumber }}current{{ end }}"
{{- if eq .PageNumber $pag.PageNumber -}}aria-current="page" {{- end -}} href="{{ .URL }}"
aria-label="Page {{ .PageNumber }}">
{{ .PageNumber }}
</a>
{{- end -}}
{{- end -}}
{{- end -}}
{{- /* Right ellipsis - show if current page is < last-2 */ -}}
{{- if lt $pag.PageNumber (sub $pag.TotalPages 2) -}}
<span class="page-link pagination-link">
{{ partial "helper/icon" "dots" }}
</span>
{{- end -}}
{{- /* Last page (if more than 1 page total) */ -}}
{{- if gt $pag.TotalPages 1 -}}
<a class="page-link {{ if eq $pag.PageNumber $pag.TotalPages }}current{{ end }}"
{{- if ne $pag.PageNumber $pag.TotalPages -}}href="{{ $pag.Last.URL }}" {{- end -}}
aria-label="Page {{ $pag.TotalPages }}"
{{- if eq $pag.PageNumber $pag.TotalPages -}}aria-current="page"{{- end -}}>
{{ $pag.TotalPages }}
</a>
{{- end -}}
{{- /* Next page button */ -}}
<a class="page-link {{ if not $pag.Next }}disabled{{ end }}"
{{- if $pag.Next -}}href="{{ $pag.Next.URL }}" {{- end -}}
aria-label="Next page"
{{- if not $pag.Next -}}aria-disabled="true"{{- end -}}>
{{ partial "helper/icon" "chevron-right" }}
</a> </a>
{{ else }}
{{ if and (not ($.Scratch.Get "hasPrevDots")) (lt .PageNumber $.Paginator.PageNumber) }}
{{ $.Scratch.Set "hasPrevDots" true }}
<span class='page-link dots'>&hellip;</span>
{{ else if and (not ($.Scratch.Get "hasNextDots")) (gt .PageNumber $.Paginator.PageNumber) }}
{{ $.Scratch.Set "hasNextDots" true }}
<span class='page-link dots'>&hellip;</span>
{{ end }}
{{ end }}
{{ end }}
</nav> </nav>
{{ end }} {{- end -}}

View File

@@ -60,7 +60,7 @@
<ol class="menu" id="main-menu"> <ol class="menu" id="main-menu">
{{ $currentPage := . }} {{ $currentPage := . }}
{{ range .Site.Menus.main }} {{ range .Site.Menus.main }}
{{ $active := or (eq $currentPage.Title .Name) (or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .)) }} {{ $active := or (eq $currentPage.RelPermalink .URL) (or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .)) }}
<li {{ if $active }} class='current' {{ end }}> <li {{ if $active }} class='current' {{ end }}>
<a href='{{ .URL }}' {{ if eq .Params.newTab true }}target="_blank"{{ end }}> <a href='{{ .URL }}' {{ if eq .Params.newTab true }}target="_blank"{{ end }}>
{{ $icon := default .Pre .Params.Icon }} {{ $icon := default .Pre .Params.Icon }}

View File

@@ -10,8 +10,7 @@
<h2 class="widget-title section-title">{{ T "widget.archives.title" }}</h2> <h2 class="widget-title section-title">{{ T "widget.archives.title" }}</h2>
{{ $pages := where $context.Site.RegularPages "Type" "in" $context.Site.Params.mainSections }} {{ $pages := where $context.Site.RegularPages "Type" "in" $context.Site.Params.mainSections }}
{{ $notHidden := where $context.Site.RegularPages "Params.hidden" "!=" true }} {{ $filtered := where $pages "Params.hidden" "!=" true }}
{{ $filtered := ($pages | intersect $notHidden) }}
{{ $archives := $filtered.GroupByDate "2006" }} {{ $archives := $filtered.GroupByDate "2006" }}
<div class="widget-archive--list"> <div class="widget-archive--list">

View File

@@ -8,7 +8,7 @@
<div class="tagCloud-tags"> <div class="tagCloud-tags">
{{ range first $limit $context.Site.Taxonomies.tags.ByCount }} {{ range first $limit $context.Site.Taxonomies.tags.ByCount }}
<a href="{{ .Page.RelPermalink }}" class="font_size_{{ .Count }}"> <a href="{{ .Page.RelPermalink }}">
{{ .Page.Title }} {{ .Page.Title }}
</a> </a>
{{ end }} {{ end }}

View File

@@ -2,7 +2,7 @@
publish = "exampleSite/public" publish = "exampleSite/public"
[build.environment] [build.environment]
HUGO_VERSION = "0.124.0" HUGO_VERSION = "0.152.2"
HUGO_THEME = "repo" HUGO_THEME = "repo"
[context.production] [context.production]