mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-04-29 03:53:30 +08:00
Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9e6b7b22a9 | ||
|
f1ab6c6aba | ||
|
087989e427 | ||
|
0991f61d49 | ||
|
839fbd0ecb | ||
|
5175ac5ae3 | ||
|
37f1541c20 | ||
|
f4eb5d3e99 | ||
|
788dd497b3 | ||
|
8a7fb33163 | ||
|
2a18a92901 | ||
|
245b0f2810 | ||
|
0fb25c808b |
@ -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);
|
||||||
|
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -18,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
|
||||||
|
@ -68,7 +68,7 @@ search:
|
|||||||
|
|
||||||
footer:
|
footer:
|
||||||
builtWith:
|
builtWith:
|
||||||
other: "مبني بستخدام {{ .Generator }}"
|
other: "مبني باستخدام {{ .Generator }}"
|
||||||
|
|
||||||
designedBy:
|
designedBy:
|
||||||
other: "قالب {{ .Theme }} مصمم من {{ .DesignedBy }}"
|
other: "قالب {{ .Theme }} مصمم من {{ .DesignedBy }}"
|
||||||
|
@ -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:
|
||||||
|
@ -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 }}
|
@ -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 },
|
||||||
@ -10,4 +11,4 @@
|
|||||||
],
|
],
|
||||||
ignoredClasses: ["gist"]
|
ignoredClasses: ["gist"]
|
||||||
});})
|
});})
|
||||||
</script>
|
</script>
|
||||||
|
@ -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>
|
||||||
|
@ -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 -}}
|
@ -1,4 +1,4 @@
|
|||||||
{{- $ThemeVersion := "3.27.0" -}}
|
{{- $ThemeVersion := "3.30.0" -}}
|
||||||
<footer class="site-footer">
|
<footer class="site-footer">
|
||||||
<section class="copyright">
|
<section class="copyright">
|
||||||
©
|
©
|
||||||
|
Loading…
Reference in New Issue
Block a user