Skip to content

Commit

Permalink
Updates (#4)
Browse files Browse the repository at this point in the history
* fix: article category overflow (CaiJimmy#1055)

closes CaiJimmy#1045

* fix(i18n): fix unlocalized article publish/lastUpdated date (CaiJimmy#1050)

closes CaiJimmy#1040

* fix: use Hugo's default RSS template value source for lastBuildDate (CaiJimmy#1006)

Use Hugo's default RSS template value source for lastBuildDate

* feat(comments): add support to Gitalk `proxy` parameter (CaiJimmy#1012)

Co-authored-by: Jimmy Cai <hi@jimmycai.com>

* feat(i18n): add Occitan translations (CaiJimmy#1034)

* feat(i18n): add Bulgarian translations (CaiJimmy#1007)

* doc: add backslash to `baseURL` in exampleSite (CaiJimmy#1009)

* chore: bump Twikoo front-end to latest released version `1.6.39` (CaiJimmy#1021)

* fix: use `css.Sass` instead of deprecated `resources.ToCSS` (CaiJimmy#1054)

* doc: add `markup.goldmark.extensions.passthrough` in exampleSite (CaiJimmy#1056)

Related: CaiJimmy#1019

* fix(exampleSite): site config key `paginate` was deprecated (CaiJimmy#1057)

fix: site config key paginate was deprecated

* release: 3.27.0

* fix: show different subtitle for each i18n variant in exampleSite (CaiJimmy#1068)

* fix(colorScheme): systemPreferScheme not initialized on start up (CaiJimmy#1061)

* fix(i18n): missing translation for title of categories widget in fr.yaml (CaiJimmy#1059)

* feat(giscus): use current language as fallback for `lang` param and add `loading` param (CaiJimmy#1075)

fix: giscus use current lang as default, and add missing `loading` params

* feat: add fingerprints to the JS file URL to utilize HTTP caching (CaiJimmy#1076)

* release: 3.28.0

* feat: search box in 404 page (CaiJimmy#1081)

* fix(giscus): fallback to `en` if no language code is set (CaiJimmy#1084)

* release: 3.29.0

---------

Co-authored-by: Jimmy Cai <hi@jimmycai.com>
Co-authored-by: weeix <weeix@users.noreply.github.com>
Co-authored-by: Anthony Simmon <simmon.anthony@gmail.com>
Co-authored-by: DashJay <45532257+dashjay@users.noreply.github.com>
Co-authored-by: ensag-dev <59049879+ensag-dev@users.noreply.github.com>
Co-authored-by: Vladimir Vitkov <5081863+zeridon@users.noreply.github.com>
Co-authored-by: saikadaramakaisosjupita <162842238+saikadaramakaisosjupita@users.noreply.github.com>
Co-authored-by: Syafa Adena <gvoze32@gmail.com>
Co-authored-by: powerfullz <61956140+powerfullz@users.noreply.github.com>
Co-authored-by: PukNgae Cryolitia <Cryolitia@gmail.com>
Co-authored-by: onavas33 <71631187+onavas33@users.noreply.github.com>
Co-authored-by: xiaoxiyao <xiyao.luoxiao@gmail.com>
  • Loading branch information
13 people authored Nov 13, 2024
1 parent 0fed866 commit 5d5d301
Show file tree
Hide file tree
Showing 19 changed files with 235 additions and 18 deletions.
1 change: 1 addition & 0 deletions assets/scss/partials/article.scss
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
.article-tags {
display: flex;
gap: 10px;
flex-wrap: wrap;

a {
color: var(--accent-color-text);
Expand Down
1 change: 0 additions & 1 deletion assets/scss/partials/layout/article.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
}

.article-tags {
flex-wrap: wrap;
text-transform: unset;
}

Expand Down
4 changes: 4 additions & 0 deletions assets/ts/colorScheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ class StackColorScheme {
constructor(toggleEl: HTMLElement) {
this.bindMatchMedia();
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);

Expand Down
9 changes: 8 additions & 1 deletion assets/ts/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,14 @@ class Search {
this.resultTitle = resultTitle;
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.bindSearchForm();
}
Expand Down
30 changes: 24 additions & 6 deletions exampleSite/hugo.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
baseurl: https://example.com
baseurl: https://example.com/
languageCode: en-us
theme: hugo-theme-stack
paginate: 3
title: Example Site
copyright: Example Person

Expand All @@ -19,20 +18,23 @@ languages:
title: Example Site
weight: 1
params:
description: Example description
sidebar:
subtitle: Example description
zh-cn:
languageName: 中文
title: 演示站点
weight: 2
params:
description: 演示说明
sidebar:
subtitle: 演示说明
ar:
languageName: عربي
languagedirection: rtl
title: موقع تجريبي
weight: 3
params:
description: وصف تجريبي
sidebar:
subtitle: وصف تجريبي

services:
# Change it to your Disqus shortname before using
Expand All @@ -42,6 +44,9 @@ services:
googleAnalytics:
id:

pagination:
pagerSize: 3

permalinks:
post: /p/:slug/
page: /:slug/
Expand Down Expand Up @@ -105,7 +110,7 @@ params:
repo:
issueTerm: pathname
label:
theme:
theme:

remark42:
host:
Expand Down Expand Up @@ -164,6 +169,7 @@ params:
repo:
clientID:
clientSecret:
proxy:

cusdis:
host:
Expand Down Expand Up @@ -242,6 +248,18 @@ related:

markup:
goldmark:
extensions:
passthrough:
enable: true
delimiters:
block:
- - \[
- \]
- - $$
- $$
inline:
- - \(
- \)
renderer:
## Set to true if you have HTML content inside Markdown
unsafe: true
Expand Down
73 changes: 73 additions & 0 deletions i18n/bg.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
3 changes: 3 additions & 0 deletions i18n/fr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ widget:
tagCloud:
title:
other: Mots clés
categoriesCloud:
title:
other: Catégories

search:
title:
Expand Down
72 changes: 72 additions & 0 deletions i18n/oc.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
38 changes: 38 additions & 0 deletions layouts/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
2 changes: 1 addition & 1 deletion layouts/_default/rss.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<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 }}
<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" -}}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/article/components/details.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ <h3 class="article-subtitle">
<div>
{{ partial "helper/icon" "date" }}
<time class="article-time--published">
{{- .Date.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") -}}
{{- .Date | time.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") -}}
</time>
</div>
{{ end }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/article/components/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<section class="article-lastmod">
{{ partial "helper/icon" "clock" }}
<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>
</section>
{{- end -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/comments/provider/disqusjs.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{- $disqusjs := .Site.Params.Comments.disqusjs -}}
{{- 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 }}">

<div class="disqus-container">
Expand Down
3 changes: 2 additions & 1 deletion layouts/partials/comments/provider/giscus.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
data-emit-metadata="{{- default 0 .emitMetadata -}}"
data-input-position="{{- default `top` .inputPosition -}}"
data-theme="{{- default `light` .lightTheme -}}"
data-lang="{{- default `en` .lang -}}"
data-lang="{{- default (default `en` $.Language.LanguageCode) .lang -}}"
data-loading="{{- .loading -}}"
crossorigin="anonymous"
async
></script>
Expand Down
1 change: 1 addition & 0 deletions layouts/partials/comments/provider/gitalk.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
admin: ["{{- .admin -}}"],
distractionFreeMode: false, // Facebook-like distraction free mode
id: md5(location.pathname), // Max Location.pathname Legth:75 https://github.com/gitalk/gitalk/issues/102
proxy: {{- .proxy -}},
});
(function () {
if (
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/comments/provider/twikoo.html
Original file line number Diff line number Diff line change
@@ -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.39/dist/twikoo.all.min.js"></script>
<div id="tcomment"></div>
<style>
.twikoo {
Expand Down
Loading

0 comments on commit 5d5d301

Please sign in to comment.