forked from Sync/hugo-theme-stack
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
f5cbf84768 | |||
a0d929586b | |||
2858c527b0 | |||
|
087989e427 | ||
|
0991f61d49 | ||
|
839fbd0ecb | ||
|
5175ac5ae3 | ||
|
37f1541c20 |
@ -53,7 +53,14 @@ class Search {
|
||||
this.resultTitle = resultTitle;
|
||||
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.bindQueryStringChange();
|
||||
this.bindSearchForm();
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ search:
|
||||
|
||||
footer:
|
||||
builtWith:
|
||||
other: "مبني بستخدام {{ .Generator }}"
|
||||
other: "مبني باستخدام {{ .Generator }}"
|
||||
|
||||
designedBy:
|
||||
other: "قالب {{ .Theme }} مصمم من {{ .DesignedBy }}"
|
||||
|
@ -66,8 +66,11 @@ search:
|
||||
other: "#PAGES_COUNT pages (#TIME_SECONDS seconds)"
|
||||
|
||||
footer:
|
||||
builtWith:
|
||||
other: Built with {{ .Generator }}
|
||||
poweredBy:
|
||||
other: Build {{ .Commit }} in {{ .Channel }} channel
|
||||
|
||||
designedBy:
|
||||
other: Theme {{ .Theme }} designed by {{ .DesignedBy }}
|
||||
|
||||
forkedBy:
|
||||
other: Forked with 💖 by {{ .ForkedBy }}
|
||||
|
@ -60,8 +60,11 @@ search:
|
||||
other: "#PAGES_COUNT 个结果 (用时 #TIME_SECONDS 秒)"
|
||||
|
||||
footer:
|
||||
builtWith:
|
||||
other: 使用 {{ .Generator }} 构建
|
||||
poweredBy:
|
||||
other: 构建版本 {{ .Commit }} 于 {{ .Channel }} 频道
|
||||
|
||||
designedBy:
|
||||
other: 主题 {{ .Theme }} 由 {{ .DesignedBy }} 设计
|
||||
|
||||
forkedBy:
|
||||
other: 由 {{ .ForkedBy }} 带着 💖 分叉修改
|
@ -3,5 +3,43 @@
|
||||
<h1 class="article-title">{{ T "notFound.title" }}</h1>
|
||||
<h2 class="article-subtitle">{{ T "notFound.subtitle" }}</h2>
|
||||
</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" . }}
|
||||
{{ end }}
|
@ -1,7 +1,8 @@
|
||||
{{- partial "helper/external" (dict "Context" . "Namespace" "KaTeX") -}}
|
||||
<script>
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
renderMathInElement(document.body, {
|
||||
const mainArticleElement = document.querySelector(".main-article");
|
||||
renderMathInElement(mainArticleElement, {
|
||||
delimiters: [
|
||||
{ left: "$$", right: "$$", display: true },
|
||||
{ left: "$", right: "$", display: false },
|
||||
|
@ -11,7 +11,7 @@
|
||||
data-emit-metadata="{{- default 0 .emitMetadata -}}"
|
||||
data-input-position="{{- default `top` .inputPosition -}}"
|
||||
data-theme="{{- default `light` .lightTheme -}}"
|
||||
data-lang="{{- default $.Language.LanguageCode .lang -}}"
|
||||
data-lang="{{- default (default `en` $.Language.LanguageCode) .lang -}}"
|
||||
data-loading="{{- .loading -}}"
|
||||
crossorigin="anonymous"
|
||||
async
|
||||
|
@ -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">
|
||||
<section class="copyright">
|
||||
©
|
||||
@ -14,10 +17,14 @@
|
||||
{{ end }}
|
||||
|
||||
{{- $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>` -}}
|
||||
{{- $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.designedBy" (dict "Theme" $Theme "DesignedBy" $DesignedBy) | safeHTML }}
|
||||
{{ T "footer.poweredBy" (dict "Commit" $Commit "Channel" $Channel) | safeHTML }} <br />
|
||||
{{ T "footer.designedBy" (dict "Theme" $Theme "DesignedBy" $DesignedBy) | safeHTML }} <br />
|
||||
{{ T "footer.forkedBy" (dict "ForkedBy" $ForkedBy) | safeHTML }}
|
||||
</section>
|
||||
</footer>
|
||||
|
Loading…
Reference in New Issue
Block a user