Compare commits

...

8 Commits

Author SHA1 Message Date
f5cbf84768
fix(footer): change theme repo link 2025-01-05 16:59:32 +08:00
a0d929586b
feat: add commitID and channel in footer 2025-01-05 16:40:30 +08:00
2858c527b0
fix(footer): add Hugo version 2025-01-05 14:13:27 +08: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
8 changed files with 72 additions and 13 deletions

View File

@ -53,7 +53,14 @@ class Search {
this.resultTitle = resultTitle; this.resultTitle = resultTitle;
this.resultTitleTemplate = resultTitleTemplate; this.resultTitleTemplate = resultTitleTemplate;
this.handleQueryString(); /// 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.bindQueryStringChange(); this.bindQueryStringChange();
this.bindSearchForm(); this.bindSearchForm();
} }

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

@ -66,8 +66,11 @@ search:
other: "#PAGES_COUNT pages (#TIME_SECONDS seconds)" other: "#PAGES_COUNT pages (#TIME_SECONDS seconds)"
footer: footer:
builtWith: poweredBy:
other: Built with {{ .Generator }} other: Build {{ .Commit }} in {{ .Channel }} channel
designedBy: designedBy:
other: Theme {{ .Theme }} designed by {{ .DesignedBy }} other: Theme {{ .Theme }} designed by {{ .DesignedBy }}
forkedBy:
other: Forked with 💖 by {{ .ForkedBy }}

View File

@ -60,8 +60,11 @@ search:
other: "#PAGES_COUNT 个结果 (用时 #TIME_SECONDS 秒)" other: "#PAGES_COUNT 个结果 (用时 #TIME_SECONDS 秒)"
footer: footer:
builtWith: poweredBy:
other: 使用 {{ .Generator }} 构建 other: 构建版本 {{ .Commit }} 于 {{ .Channel }} 频道
designedBy: designedBy:
other: 主题 {{ .Theme }} 由 {{ .DesignedBy }} 设计 other: 主题 {{ .Theme }} 由 {{ .DesignedBy }} 设计
forkedBy:
other: 由 {{ .ForkedBy }} 带着 💖 分叉修改

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,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

@ -11,7 +11,7 @@
data-emit-metadata="{{- default 0 .emitMetadata -}}" data-emit-metadata="{{- default 0 .emitMetadata -}}"
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 $.Language.LanguageCode .lang -}}" data-lang="{{- default (default `en` $.Language.LanguageCode) .lang -}}"
data-loading="{{- .loading -}}" data-loading="{{- .loading -}}"
crossorigin="anonymous" crossorigin="anonymous"
async async

View File

@ -1,4 +1,7 @@
{{- $ThemeVersion := "3.28.0" -}} {{- $ThemeVersion := "3.29.0" -}}
{{- $BuildID := .Site.Data.Build.ID -}}
{{- $BuildURL := .Site.Data.Build.URL -}}
{{- $BuildChannel := .Site.Data.Build.Channel -}}
<footer class="site-footer"> <footer class="site-footer">
<section class="copyright"> <section class="copyright">
&copy; &copy;
@ -14,10 +17,14 @@
{{ end }} {{ end }}
{{- $Generator := `<a href="https://gohugo.io/" target="_blank" rel="noopener">Hugo</a>` -}} {{- $Generator := `<a href="https://gohugo.io/" target="_blank" rel="noopener">Hugo</a>` -}}
{{- $Theme := printf `<b><a href="https://github.com/CaiJimmy/hugo-theme-stack" target="_blank" rel="noopener" data-version="%s">Stack</a></b>` $ThemeVersion -}} {{- $Theme := printf `<a href="https://github.com/CaiJimmy/hugo-theme-stack" target="_blank" rel="noopener" data-version="%s">Stack</a>` $ThemeVersion -}}
{{- $DesignedBy := `<a href="https://jimmycai.com" target="_blank" rel="noopener">Jimmy</a>` -}} {{- $DesignedBy := `<a href="https://jimmycai.com" target="_blank" rel="noopener">Jimmy</a>` -}}
{{- $ForkedBy := `<a href="https://sunyz.dev" target="_blank" rel="noopener">Seven</a>` -}}
{{- $Commit := printf `<a href="%s" target="_blank" rel="noopener">%s</a>` $BuildURL $BuildID -}}
{{- $Channel := printf `%s` $BuildChannel -}}
{{ T "footer.builtWith" (dict "Generator" $Generator) | safeHTML }} <br /> {{ T "footer.poweredBy" (dict "Commit" $Commit "Channel" $Channel) | safeHTML }} <br />
{{ T "footer.designedBy" (dict "Theme" $Theme "DesignedBy" $DesignedBy) | safeHTML }} {{ T "footer.designedBy" (dict "Theme" $Theme "DesignedBy" $DesignedBy) | safeHTML }} <br />
{{ T "footer.forkedBy" (dict "ForkedBy" $ForkedBy) | safeHTML }}
</section> </section>
</footer> </footer>