Merge branch 'master' into canary

This commit is contained in:
Jimmy Cai 2023-08-24 21:36:55 +02:00
commit 5063e8f0b8
21 changed files with 167 additions and 42 deletions

View File

@ -1,17 +1,15 @@
name: Bug Report name: Bug Report
description: File a bug report description: File a bug report
title: "[Bug]: "
labels: ["bug"]
body: body:
- type: markdown - type: markdown
attributes: attributes:
value: | value: |
Thanks for taking the time to fill out this bug report! Please provide as much information as possible and make sure you have checked the [documentation](https://docs.stack.jimmycai.com/). Thanks for taking the time to fill out this bug report! Please provide as much information as possible and make sure you have checked the [documentation](https://stack.jimmycai.com/).
- type: textarea - type: textarea
id: what-happened id: what-happened
attributes: attributes:
label: What happened? label: What happened?
description: Also tell us, what did you expect to happen? Please be as detailed as possible, include screenshots and any other information that might help us reproduce the problem. description: Also tell us, what did you expect to happen? Please be as detailed as possible, including screenshots and any other information that might help us reproduce the problem.
placeholder: Tell us what you see! placeholder: Tell us what you see!
validations: validations:
required: true required: true
@ -55,21 +53,13 @@ body:
label: Relevant log output label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell render: shell
- type: markdown
attributes:
value: |
If the issue is not present on the [demo site](https://demo.stack.jimmycai.com), in order to better understand the problem, please provide the link to the source code of your website (not the generated HTML).
Or link to a minimal reproduction of the problem if there are sensible data.
- type: input - type: input
id: bug-url id: minimal-reproduction-url
attributes: attributes:
label: Link to the page with bug label: Link to Minimal Reproducible Example
placeholder: https://demo.stack.jimmycai.com description: |
value: https://demo.stack.jimmycai.com Use [CaiJimmy/hugo-theme-stack-starter](https://github.com/CaiJimmy/hugo-theme-stack-starter) to create a minimal reproduction of the problem.
A minimal reproduction is required so that others can help debug your issue. If a report is vague (e.g. just a generic error message) and has no reproduction, it may be auto-closed.
placeholder: https://github.com/username/your-repository
validations: validations:
required: true required: true
- type: input
id: source-repo
attributes:
label: Link to the source repository
placeholder: https://github.com/CaiJimmy/hugo-theme-stack

View File

@ -12,7 +12,7 @@ Use this template: [CaiJimmy/hugo-theme-stack-starter](https://github.com/CaiJim
## Demo ## Demo
* Stater template demo: [demo.stack.jimmycai.com](https://demo.stack.jimmycai.com) * Starter template demo: [demo.stack.jimmycai.com](https://demo.stack.jimmycai.com)
* Dev build: [dev.stack.jimmycai.com](https://dev.stack.jimmycai.com) * Dev build: [dev.stack.jimmycai.com](https://dev.stack.jimmycai.com)
## Documentation ## Documentation

View File

@ -92,16 +92,15 @@
.article-time, .article-time,
.article-translations { .article-translations {
display: flex; display: flex;
align-items: center;
color: var(--card-text-color-tertiary); color: var(--card-text-color-tertiary);
gap: 15px; gap: 15px;
flex-wrap: wrap;
svg { svg {
vertical-align: middle; vertical-align: middle;
width: 20px; width: 20px;
height: 20px; height: 20px;
stroke-width: 1.33; stroke-width: 1.33;
flex-shrink: 0;
} }
time, time,
@ -117,6 +116,16 @@
} }
} }
.article-time {
flex-wrap: wrap;
}
.article-translations {
& > div {
flex-wrap: wrap;
}
}
.article-category, .article-category,
.article-tags { .article-tags {
display: flex; display: flex;

View File

@ -264,6 +264,11 @@
font-family: var(--code-font-family); font-family: var(--code-font-family);
} }
a,
code {
word-break: break-word;
}
.gallery { .gallery {
position: relative; position: relative;
display: flex; display: flex;
@ -430,4 +435,14 @@
overflow-x: auto; overflow-x: auto;
overflow-y: hidden; overflow-y: hidden;
} }
kbd {
border: 1px solid var(--kbd-border-color);
font-weight: bold;
font-size: 0.9em;
line-height: 1;
padding: 2px 4px;
border-radius: 4px;
display: inline-block;
}
} }

View File

@ -83,6 +83,7 @@
@include respond(lg) { @include respond(lg) {
padding-top: var(--main-top-padding); padding-top: var(--main-top-padding);
padding-bottom: var(--main-top-padding);
} }
} }

View File

@ -16,7 +16,7 @@ $defaultTagColors: #fff, #fff, #fff, #fff, #fff;
--accent-color: #34495e; --accent-color: #34495e;
--accent-color-darker: #2c3e50; --accent-color-darker: #2c3e50;
--accent-color-text: #fff; --accent-color-text: #fff;
--body-text-color: #bababa; --body-text-color: #707070;
--tag-border-radius: 4px; --tag-border-radius: 4px;
@ -56,7 +56,7 @@ $defaultTagColors: #fff, #fff, #fff, #fff, #fff;
--card-text-color-main: #000; --card-text-color-main: #000;
--card-text-color-secondary: #747474; --card-text-color-secondary: #747474;
--card-text-color-tertiary: #bababa; --card-text-color-tertiary: #767676;
--card-separator-color: rgba(218, 218, 218, 0.5); --card-separator-color: rgba(218, 218, 218, 0.5);
--card-border-radius: 10px; --card-border-radius: 10px;
@ -123,6 +123,8 @@ $defaultTagColors: #fff, #fff, #fff, #fff, #fff;
--table-border-color: #dadada; --table-border-color: #dadada;
--tr-even-background-color: #efefee; --tr-even-background-color: #efefee;
--kbd-border-color: #dadada;
&[data-scheme="dark"] { &[data-scheme="dark"] {
--code-background-color: #272822; --code-background-color: #272822;
--code-text-color: rgba(255, 255, 255, 0.9); --code-text-color: rgba(255, 255, 255, 0.9);

View File

@ -227,6 +227,7 @@ class Search {
Search.updateQueryString(keywords, true); Search.updateQueryString(keywords, true);
if (keywords === '') { if (keywords === '') {
lastSearch = '';
return this.clear(); return this.clear();
} }

View File

@ -21,8 +21,8 @@ function setupSmoothAnchors() {
aElement.addEventListener("click", clickEvent => { aElement.addEventListener("click", clickEvent => {
clickEvent.preventDefault(); clickEvent.preventDefault();
const targetId = aElement.getAttribute("href").substring(1), const targetId = decodeURI(aElement.getAttribute("href").substring(1)),
target = document.getElementById(targetId) as HTMLElement, target = document.getElementById(targetId) as HTMLElement,
offset = target.getBoundingClientRect().top - document.documentElement.getBoundingClientRect().top; offset = target.getBoundingClientRect().top - document.documentElement.getBoundingClientRect().top;
window.history.pushState({}, "", aElement.getAttribute("href")); window.history.pushState({}, "", aElement.getAttribute("href"));

View File

@ -150,7 +150,7 @@ H<sub>2</sub>O
X<sup>n</sup> + Y<sup>n</sup> = Z<sup>n</sup> X<sup>n</sup> + Y<sup>n</sup> = Z<sup>n</sup>
Press <kbd><kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>Delete</kbd></kbd> to end the session. Press <kbd>CTRL</kbd> + <kbd>ALT</kbd> + <kbd>Delete</kbd> to end the session.
Most <mark>salamanders</mark> are nocturnal, and hunt for insects, worms, and other small creatures. Most <mark>salamanders</mark> are nocturnal, and hunt for insects, worms, and other small creatures.

View File

@ -37,11 +37,7 @@ In this example we will be using [KaTeX](https://katex.org/)
### Examples ### Examples
{{< math.inline >}} Inline math: $\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…$
<p>
Inline math: \(\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…\)
</p>
{{</ math.inline >}}
Block math: Block math:
$$ $$

View File

@ -5,11 +5,15 @@ darkMode: Tryb ciemny
list: list:
page: page:
one: "{{ .Count }} strona" one: "{{ .Count }} strona"
few: "{{ .Count }} strony"
many: "{{ .Count }} stron"
other: "{{ .Count }} stron" other: "{{ .Count }} stron"
section: Sekcja section: Sekcja
subsection: subsection:
one: Podsekcja one: Podsekcja
other: Podsekcje few: Podsekcje
many: Podsekcji
other: Podsekcji
article: article:
back: Wróć back: Wróć
@ -18,6 +22,8 @@ article:
lastUpdatedOn: Ostatnio zaktualizowany lastUpdatedOn: Ostatnio zaktualizowany
readingTime: readingTime:
one: "Przeczytasz w {{ .Count }} minutę" one: "Przeczytasz w {{ .Count }} minutę"
few: "Przeczytasz w {{ .Count }} minuty"
many: "Przeczytasz w {{ .Count }} minut"
other: "Przeczytasz w {{ .Count }} minut" other: "Przeczytasz w {{ .Count }} minut"
notFound: notFound:
@ -30,13 +36,20 @@ widget:
more: Więcej more: Więcej
tagCloud: tagCloud:
title: Tagi title: Tagi
categoriesCloud: categoriesCloud:
title: Kategorie title: Kategorie
search: search:
title: Szukaj title: Szukaj
placeholder: Wpisz coś... placeholder: Wpisz coś...
resultTitle: "#PAGES_COUNT stron (#TIME_SECONDS sekund)"
resultTitle:
one: "#PAGES_COUNT strona (#TIME_SECONDS sekund)"
few: "#PAGES_COUNT strony (#TIME_SECONDS sekund)"
many: "#PAGES_COUNT stron (#TIME_SECONDS sekund)"
other: "#PAGES_COUNT stron (#TIME_SECONDS sekund)"
footer: footer:
builtWith: Zbudowano z {{ .Generator }} builtWith: Zbudowano z {{ .Generator }}

74
i18n/vi.yaml Normal file
View File

@ -0,0 +1,74 @@
toggleMenu:
other: Hiển thị Menu
darkMode:
other: Chế độ nền tối
list:
page:
one: "{{ .Count }} trang"
other: "{{ .Count }} trang"
section:
other: Section
subsection:
one: Subsection
other: Subsections
article:
back:
other: Trở lại
tableOfContents:
other: Mục lục
relatedContent:
other: Bài viết liên quan
lastUpdatedOn:
other: Cập nhật lần cuối
readingTime:
one: "{{ .Count }} phút đọc"
other: "{{ .Count }} phút đọc"
notFound:
title:
other: Không tìm thấy
subtitle:
other: Trang này không tồn tại
widget:
archives:
title:
other: Lưu trữ
more:
other: Còn nữa
tagCloud:
title:
other: Nhãn dán
categoriesCloud:
title:
other: Chuỗi bài
search:
title:
other: Tìm kiếm
placeholder:
other: Nhập từ khoá ...
resultTitle:
other: "#PAGES_COUNT trang (#TIME_SECONDS giây)"
footer:
builtWith:
other: Built with {{ .Generator }}
designedBy:
other: Theme {{ .Theme }} thiết kế bởi {{ .DesignedBy }}

View File

@ -2,6 +2,18 @@ toggleMenu: 切換選單
darkMode: 夜晚模式 darkMode: 夜晚模式
list:
page:
one: "第 {{ .Count }} 頁"
other: "第 {{ .Count }} 頁"
section:
other: 段落
subsection:
one: 小節
other: 小節
article: article:
back: 返回 back: 返回
tableOfContents: 目錄 tableOfContents: 目錄
@ -19,8 +31,14 @@ widget:
more: 更多 more: 更多
tagCloud: tagCloud:
title: 標籤雲 title: 標籤雲
categoriesCloud:
title: 分類
search: search:
title: 搜尋 title: 搜尋
placeholder: 輸入關鍵字... placeholder: 輸入關鍵字...
resultTitle: "#PAGES_COUNT 個結果 (用時 #TIME_SECONDS 秒)" resultTitle: "#PAGES_COUNT 個結果 (用時 #TIME_SECONDS 秒)"
footer:
builtWith: 使用 {{ .Generator }} 建立
designedBy: 主題 {{ .Theme }} 由 {{ .DesignedBy }} 設計

View File

@ -1,11 +1,11 @@
{{ define "body-class" }}template-search{{ end }} {{ define "body-class" }}template-search{{ end }}
{{ define "head" }} {{ define "head" }}
{{- with .OutputFormats.Get "json" -}} {{- with .OutputFormats.Get "json" -}}
<link rel="preload" href="{{ .Permalink }}" as="fetch" crossorigin="anonymous"> <link rel="preload" href="{{ .RelPermalink }}" as="fetch" crossorigin="anonymous">
{{- end -}} {{- end -}}
{{ end }} {{ end }}
{{ define "main" }} {{ define "main" }}
<form action="{{ .Permalink }}" class="search-form"{{ with .OutputFormats.Get "json" -}} data-json="{{ .Permalink }}"{{- end }}> <form action="{{ .RelPermalink }}" class="search-form"{{ with .OutputFormats.Get "json" -}} data-json="{{ .RelPermalink }}"{{- end }}>
<p> <p>
<label>{{ T "search.title" }}</label> <label>{{ T "search.title" }}</label>
<input name="keyword" placeholder="{{ T `search.placeholder` }}" /> <input name="keyword" placeholder="{{ T `search.placeholder` }}" />

View File

@ -7,6 +7,7 @@
{ left: "$", right: "$", display: false }, { left: "$", right: "$", display: false },
{ left: "\\(", right: "\\)", display: false }, { left: "\\(", right: "\\)", display: false },
{ left: "\\[", right: "\\]", display: true } { left: "\\[", right: "\\]", display: true }
] ],
ignoredClasses: ["gist"]
});}) });})
</script> </script>

View File

@ -13,7 +13,7 @@
show_email_subscription: {{ default true .show_email_subscription }} show_email_subscription: {{ default true .show_email_subscription }}
}; };
function(e, n) { !function(e, n) {
for (var o = 0; o < e.length; o++) { for (var o = 0; o < e.length; o++) {
var r = n.createElement('script'), var r = n.createElement('script'),
c = '.js', c = '.js',

View File

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

View File

@ -16,6 +16,8 @@
</style> </style>
<script> <script>
let utterancesLoaded = false;
function setUtterancesTheme(theme) { function setUtterancesTheme(theme) {
let utterances = document.querySelector('.utterances iframe'); let utterances = document.querySelector('.utterances iframe');
if (utterances) { if (utterances) {
@ -31,10 +33,14 @@
addEventListener('message', event => { addEventListener('message', event => {
if (event.origin !== 'https://utteranc.es') return; if (event.origin !== 'https://utteranc.es') return;
/// Called when Utterances is ready
utterancesLoaded = true;
setUtterancesTheme(document.documentElement.dataset.scheme) setUtterancesTheme(document.documentElement.dataset.scheme)
}); });
window.addEventListener('onColorSchemeChange', (e) => { window.addEventListener('onColorSchemeChange', (e) => {
if (!utterancesLoaded) return;
setUtterancesTheme(e.detail) setUtterancesTheme(e.detail)
}) })
</script> </script>

View File

@ -5,7 +5,7 @@
{{ if and (.Site.Params.footer.since) (ne .Site.Params.footer.since (int (now.Format "2006"))) }} {{ if and (.Site.Params.footer.since) (ne .Site.Params.footer.since (int (now.Format "2006"))) }}
{{ .Site.Params.footer.since }} - {{ .Site.Params.footer.since }} -
{{ end }} {{ end }}
{{ now.Format "2006" }} {{ .Site.Title }} {{ now.Format "2006" }} {{ default .Site.Title .Site.Copyright }}
</section> </section>
<section class="powerby"> <section class="powerby">

View File

@ -61,9 +61,8 @@
{{ $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.Title .Name) (or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .)) }}
<li {{ if $active }} class='current' {{ end }}> <li {{ if $active }} class='current' {{ end }}>
<a href='{{ .URL | relLangURL }}' {{ 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 }}
{{ if .Pre }} {{ if .Pre }}
{{ warnf "Menu item [%s] is using [pre] field to set icon, please use [params.icon] instead.\nMore information: https://docs.stack.jimmycai.com/configuration/custom-menu.html" .URL }} {{ warnf "Menu item [%s] is using [pre] field to set icon, please use [params.icon] instead.\nMore information: https://docs.stack.jimmycai.com/configuration/custom-menu.html" .URL }}

View File

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