From aa1709fbdd05527bc64f3e786b0bd3afed9ae67a Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Fri, 15 Nov 2024 14:24:08 +0800 Subject: [PATCH 01/25] :wheelchair: Feat: always show collection list and navigation --- layouts/partials/init/index.html | 2 +- layouts/partials/single/collection-list.html | 2 +- layouts/partials/single/collection-nav.html | 2 +- layouts/posts/single.html | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/layouts/partials/init/index.html b/layouts/partials/init/index.html index 64cfbd643..3e030dcee 100644 --- a/layouts/partials/init/index.html +++ b/layouts/partials/init/index.html @@ -1,4 +1,4 @@ -{{- .Scratch.Set "version" "v0.3.15" -}} +{{- .Scratch.Set "version" "v0.3.16-fcb0f1ef" -}} {{- .Scratch.Set "this" dict -}} {{- partial "init/detection-env.html" . -}} diff --git a/layouts/partials/single/collection-list.html b/layouts/partials/single/collection-list.html index 2f0694f28..38d323f95 100644 --- a/layouts/partials/single/collection-list.html +++ b/layouts/partials/single/collection-list.html @@ -8,7 +8,7 @@ {{- $open := eq (index $collectionTerms 0) . -}} {{- $currentKey := 0 -}} -
+
{{ dict "Class" "fa-solid fa-layer-group fa-fw" | partial "plugin/icon.html" }} {{ .LinkTitle }} diff --git a/layouts/partials/single/collection-nav.html b/layouts/partials/single/collection-nav.html index 2754a5fd0..5c63d85e4 100644 --- a/layouts/partials/single/collection-nav.html +++ b/layouts/partials/single/collection-nav.html @@ -10,7 +10,7 @@ (T "collection") .LinkTitle -}} -
+
{{- dict "Collections" $termLink | T "single.includedIn.collections" | strings.FirstUpper | safeHTML }} {{ .Pages.Len -}}
diff --git a/layouts/posts/single.html b/layouts/posts/single.html index 5e5509ff1..b2592a396 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -178,12 +178,12 @@

{{- partial "single/reward.html" . -}} {{- end -}} - {{- /* Collection Navigation */ -}} - {{- partial "single/collection-nav.html" . -}} - {{- /* Content Encryption */ -}} {{- dict "Content" $content "Password" $params.password "Message" $params.message | partial "plugin/fixit-encryptor.html" -}} + {{- /* Collection Navigation */ -}} + {{- partial "single/collection-nav.html" . -}} + {{- /* Custom block before post footer */ -}} {{- block "custom-post__footer:before" . }}{{ end -}} From 9913731705eec2d6f6d9a0f056e843a7e7344be6 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Fri, 15 Nov 2024 19:51:18 +0800 Subject: [PATCH 02/25] :lipstick: Style: update summary delimiter style --- assets/css/_core/_header.scss | 7 ++----- assets/css/_core/_root.scss | 9 +++++++-- assets/css/_page/_home.scss | 30 +++++++++++++++++++----------- assets/css/_page/_single.scss | 7 +------ assets/css/_variables.scss | 1 + layouts/partials/init/index.html | 2 +- 6 files changed, 31 insertions(+), 25 deletions(-) diff --git a/assets/css/_core/_header.scss b/assets/css/_core/_header.scss index b684e3ea5..80522e0f9 100644 --- a/assets/css/_core/_header.scss +++ b/assets/css/_core/_header.scss @@ -384,6 +384,8 @@ header { @include scrollbar-width(none, 0); [data-theme='dark'] & { + background: $header-background-color-dark; + border-top-color: $global-border-color-dark; @include box-shadow(0 0.125rem 0.25rem rgba(255, 255, 255, 0.1)); } @@ -512,11 +514,6 @@ header { &.active { display: block; } - - [data-theme='dark'] & { - background: $header-background-color-dark; - border-top-color: $global-border-color-dark; - } } } diff --git a/assets/css/_core/_root.scss b/assets/css/_core/_root.scss index 20357ffa3..b8a251c88 100644 --- a/assets/css/_core/_root.scss +++ b/assets/css/_core/_root.scss @@ -1,5 +1,9 @@ :root { // Note: Custom variable values only support SassScript inside `#{}`. + // TODO migrate SCSS variables to CSS variables + + --#{$prefix}global-font-color: #{$global-font-color}; + --#{$prefix}global-border-color: #{$global-border-color}; // Theme colors variables @each $color, $value in $theme-colors { @@ -22,12 +26,13 @@ --#{$prefix}scrollbar-track-color: transparent; --#{$prefix}scrollbar-width: thin; --#{$prefix}scrollbar-width-legacy: 12px; - - // TODO migrate SCSS variables to CSS variables } // Dark theme [data-theme=dark] { + --#{$prefix}global-font-color: #{$global-font-color-dark}; + --#{$prefix}global-border-color: #{$global-border-color-dark}; + @each $color, $value in $theme-colors { --#{$prefix}#{$color}: #{darken($value, 5%)}; } diff --git a/assets/css/_page/_home.scss b/assets/css/_page/_home.scss index 17662b930..aa224861c 100644 --- a/assets/css/_page/_home.scss +++ b/assets/css/_page/_home.scss @@ -81,18 +81,26 @@ } .summary { - padding-top: 1rem; - padding-bottom: 0.8rem; - color: $global-font-color; - border-bottom: 1px dashed $global-border-color; + padding-block: 1rem; + color: var(--#{$prefix}global-font-color); - &:first-of-type { - padding-top: 0; + &:not(:last-of-type)::after { + content: ''; + position: absolute; + width: 100%; + padding: 2px; + transform: translateY(18px); + background: repeating-linear-gradient( + 135deg, + var(--#{$prefix}hr-background-color) 0px, + var(--#{$prefix}hr-background-color) 4px, + transparent 4px, + transparent 8px + ); } - [data-theme='dark'] & { - color: $global-font-color-dark; - border-bottom: 1px dashed $global-border-color-dark; + &:first-of-type { + padding-top: 0; } .featured-image-preview { @@ -144,7 +152,7 @@ } .post-footer { - margin-top: 0.4rem; + margin-block: 0.4rem 0; display: flex; justify-content: space-between; align-items: center; @@ -156,7 +164,7 @@ padding: 0; @include link(true, true); - + .post-tag:not(:last-child)::after { content: ','; margin-right: 0.25rem; diff --git a/assets/css/_page/_single.scss b/assets/css/_page/_single.scss index 05f59d448..e0de17edd 100644 --- a/assets/css/_page/_single.scss +++ b/assets/css/_page/_single.scss @@ -97,6 +97,7 @@ hr { position: relative; height: 1em; + margin-block: 1em; background: linear-gradient(to right, var(--#{$prefix}hr-background-color) 50%, transparent 50%); background-size: 10px 2px; background-position: center; @@ -104,8 +105,6 @@ border: none; &.awesome-hr { - margin-block: 0.5em; - &::before { display: inline-block; font-weight: 600; @@ -495,10 +494,6 @@ } } - hr { - margin-block: 0; - } - kbd { display: inline-block; padding: 0 0.25rem; diff --git a/assets/css/_variables.scss b/assets/css/_variables.scss index e92cf487c..22d8c5e76 100644 --- a/assets/css/_variables.scss +++ b/assets/css/_variables.scss @@ -39,6 +39,7 @@ $global-link-hover-color: #2983bb !default; // 潮蓝 $global-link-hover-color-dark: #fff !default; // Color of the border +// TODO refactor border colors $global-border-color: #f0f0f0 !default; $global-border-color-dark: #363636 !default; // ========== Global ========== // diff --git a/layouts/partials/init/index.html b/layouts/partials/init/index.html index 3e030dcee..91a2a3fc5 100644 --- a/layouts/partials/init/index.html +++ b/layouts/partials/init/index.html @@ -1,4 +1,4 @@ -{{- .Scratch.Set "version" "v0.3.16-fcb0f1ef" -}} +{{- .Scratch.Set "version" "v0.3.16-aa1709fb" -}} {{- .Scratch.Set "this" dict -}} {{- partial "init/detection-env.html" . -}} From a073b0e9f25f7fc9d0d67fe28c20c2b5b94c10f8 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Mon, 18 Nov 2024 10:56:33 +0800 Subject: [PATCH 03/25] :pencil: Docs: update hugo.toml --- hugo.toml | 7 ++++++- layouts/partials/init/index.html | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hugo.toml b/hugo.toml index 727639958..9d7296258 100644 --- a/hugo.toml +++ b/hugo.toml @@ -178,8 +178,13 @@ enableEmoji = true enable = true [markup.goldmark.extensions.extras.superscript] enable = true - # TODO passthrough refactor https://gohugo.io/getting-started/configuration-markup/#parserattributeblock + # TODO passthrough refactor https://gohugo.io/render-hooks/passthrough/ # TODO hugo 0.122.0 https://gohugo.io/content-management/mathematics/ + # [markup.goldmark.extensions.passthrough] + # enable = true + # [markup.goldmark.extensions.passthrough.delimiters] + # block = [['\[', '\]'], ['$$', '$$']] + # inline = [['\(', '\)'], ['$', '$']] [markup.goldmark.parser] [markup.goldmark.parser.attribute] block = true diff --git a/layouts/partials/init/index.html b/layouts/partials/init/index.html index 91a2a3fc5..a0900c325 100644 --- a/layouts/partials/init/index.html +++ b/layouts/partials/init/index.html @@ -1,4 +1,4 @@ -{{- .Scratch.Set "version" "v0.3.16-aa1709fb" -}} +{{- .Scratch.Set "version" "v0.3.16-99137317" -}} {{- .Scratch.Set "this" dict -}} {{- partial "init/detection-env.html" . -}} From 0af0b136badf3f9164de5f1f6840b972fb55bf79 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Tue, 19 Nov 2024 09:55:44 +0800 Subject: [PATCH 04/25] :wrench: Chore: update build command --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a17fdde67..b20e9ec61 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,4 +18,4 @@ jobs: hugo-version: latest extended: true - name: Build Hugo static files - run: hugo -v --source=demo --gc --minify + run: hugo --source=demo --gc --minify --logLevel info From 453ed31df0b2e9765afe2324d7c9a689fa2806a3 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Tue, 19 Nov 2024 11:09:15 +0800 Subject: [PATCH 05/25] :lipstick: Style: update task list style --- assets/css/_page/_single.scss | 5 ++++- layouts/partials/init/index.html | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/assets/css/_page/_single.scss b/assets/css/_page/_single.scss index e0de17edd..5713dfb4d 100644 --- a/assets/css/_page/_single.scss +++ b/assets/css/_page/_single.scss @@ -248,11 +248,14 @@ li[data-task='x'], li[data-task='-'] { --#{$prefix}task-color: var(--#{$prefix}secondary); - text-decoration: line-through; + text-decoration: line-through rgba(145, 145, 145, 0.6); } li[data-task='x'] { --#{$prefix}checkbox-color: var(--#{$prefix}primary); } + li[data-task='-'] { + opacity: 0.6; + } li[data-task='/'] { --#{$prefix}task-color: var(--#{$prefix}success); } diff --git a/layouts/partials/init/index.html b/layouts/partials/init/index.html index a0900c325..60e010c6d 100644 --- a/layouts/partials/init/index.html +++ b/layouts/partials/init/index.html @@ -1,4 +1,4 @@ -{{- .Scratch.Set "version" "v0.3.16-99137317" -}} +{{- .Scratch.Set "version" "v0.3.16-0af0b136" -}} {{- .Scratch.Set "this" dict -}} {{- partial "init/detection-env.html" . -}} From 35cc57e64df9b89a5396647f78053c9eef6aa332 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Tue, 19 Nov 2024 17:21:40 +0800 Subject: [PATCH 06/25] :wrench: Chore: add "-O" flag to hugo server command --- layouts/partials/init/index.html | 2 +- package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/layouts/partials/init/index.html b/layouts/partials/init/index.html index 60e010c6d..eb6fd8717 100644 --- a/layouts/partials/init/index.html +++ b/layouts/partials/init/index.html @@ -1,4 +1,4 @@ -{{- .Scratch.Set "version" "v0.3.16-0af0b136" -}} +{{- .Scratch.Set "version" "v0.3.16-453ed31d" -}} {{- .Scratch.Set "this" dict -}} {{- partial "init/detection-env.html" . -}} diff --git a/package.json b/package.json index c274eab37..2e9286252 100644 --- a/package.json +++ b/package.json @@ -21,9 +21,9 @@ "type": "module", "scripts": { "build": "hugo --source=demo --themesDir ../.. --theme $PWD --gc --minify --logLevel info", - "server": "hugo server --source=demo --themesDir ../.. --theme $PWD -D --disableFastRender --navigateToChanged --ignoreCache", + "server": "hugo server --source=demo --themesDir ../.. --theme $PWD -D --disableFastRender --navigateToChanged --ignoreCache -O", "server:production": "npm run server -- -e production", - "server:docs": "hugo server --source=../fixit-docs -D --disableFastRender --navigateToChanged --ignoreCache", + "server:docs": "hugo server --source=../fixit-docs -D --disableFastRender --navigateToChanged --ignoreCache -O", "version": "fixit-releaser version --prod", "postversion": "git push && git push --tags && npm run release", "release": "fixit-releaser changelog", From fd000ad6b30e31198a2f0f3eb516ef46abb357e6 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Wed, 20 Nov 2024 12:48:13 +0800 Subject: [PATCH 07/25] :bug: Fix: table-wrapper and katex-display overflow-x error --- assets/css/_page/_single.scss | 7 +++++++ layouts/partials/init/index.html | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/assets/css/_page/_single.scss b/assets/css/_page/_single.scss index 5713dfb4d..28169b7d9 100644 --- a/assets/css/_page/_single.scss +++ b/assets/css/_page/_single.scss @@ -306,6 +306,7 @@ } .table-wrapper { + position: relative; overflow-x: auto; --#{$prefix}scrollbar-thumb-color: #{$table-background-color}; @@ -516,6 +517,12 @@ } } + // Katex styles + .katex-display { + max-width: 100%; + overflow-x: auto; + } + @import '../_partials/_single/alert'; @import '../_partials/_single/code'; @import '../_shortcodes'; diff --git a/layouts/partials/init/index.html b/layouts/partials/init/index.html index eb6fd8717..67d16ee04 100644 --- a/layouts/partials/init/index.html +++ b/layouts/partials/init/index.html @@ -1,4 +1,4 @@ -{{- .Scratch.Set "version" "v0.3.16-453ed31d" -}} +{{- .Scratch.Set "version" "v0.3.16-35cc57e6" -}} {{- .Scratch.Set "this" dict -}} {{- partial "init/detection-env.html" . -}} From 3c96081689082b720117755a8bc0b619cb66b957 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Wed, 20 Nov 2024 15:14:02 +0800 Subject: [PATCH 08/25] :bug: Fix: katex-display height overflow --- assets/css/_page/_single.scss | 1 + layouts/partials/init/index.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/css/_page/_single.scss b/assets/css/_page/_single.scss index 28169b7d9..051a2dc1a 100644 --- a/assets/css/_page/_single.scss +++ b/assets/css/_page/_single.scss @@ -521,6 +521,7 @@ .katex-display { max-width: 100%; overflow-x: auto; + padding-block: 2px; } @import '../_partials/_single/alert'; diff --git a/layouts/partials/init/index.html b/layouts/partials/init/index.html index 67d16ee04..1583ec060 100644 --- a/layouts/partials/init/index.html +++ b/layouts/partials/init/index.html @@ -1,4 +1,4 @@ -{{- .Scratch.Set "version" "v0.3.16-35cc57e6" -}} +{{- .Scratch.Set "version" "v0.3.16-fd000ad6" -}} {{- .Scratch.Set "this" dict -}} {{- partial "init/detection-env.html" . -}} From f1ba78efa1df99d0f6b5b52de095557c14052554 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Thu, 21 Nov 2024 10:37:23 +0800 Subject: [PATCH 09/25] :wrench: Chore: update package name and mini node version --- .nvmrc | 1 + layouts/partials/init/index.html | 2 +- package-lock.json | 7 +++++-- package.json | 7 +++++-- 4 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 .nvmrc diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 000000000..0828ab794 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v18 \ No newline at end of file diff --git a/layouts/partials/init/index.html b/layouts/partials/init/index.html index 1583ec060..ca2116ef0 100644 --- a/layouts/partials/init/index.html +++ b/layouts/partials/init/index.html @@ -1,4 +1,4 @@ -{{- .Scratch.Set "version" "v0.3.16-fd000ad6" -}} +{{- .Scratch.Set "version" "v0.3.16-0ed41783" -}} {{- .Scratch.Set "this" dict -}} {{- partial "init/detection-env.html" . -}} diff --git a/package-lock.json b/package-lock.json index 896e3833b..869f17eb8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,16 +1,19 @@ { - "name": "fixit-src", + "name": "fixit-core", "version": "0.3.15", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "fixit-src", + "name": "fixit-core", "version": "0.3.15", "license": "MIT", "devDependencies": { "@hugo-fixit/fixit-releaser": "^1.0.1", "husky": "^9.1.6" + }, + "engines": { + "node": ">=18" } }, "node_modules/@hugo-fixit/fixit-releaser": { diff --git a/package.json b/package.json index 2e9286252..b7ce681d0 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { - "name": "fixit-src", + "name": "fixit-core", "version": "0.3.15", "private": true, - "description": "FixIt theme source files", + "description": "Hugo FixIt core theme component source files", "keywords": [ "hugo", "theme", @@ -32,5 +32,8 @@ "devDependencies": { "@hugo-fixit/fixit-releaser": "^1.0.1", "husky": "^9.1.6" + }, + "engines": { + "node": ">=18" } } From fb80b8b3dcb3c8129f4cd80dfdbb61c0fc041979 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Fri, 22 Nov 2024 17:45:23 +0800 Subject: [PATCH 10/25] :sparkles: Feat: add Baidu, Umami, Plausible, Cloudflare and Splitbee analytics support resolved #549 --- README.md | 5 +++ README.zh-cn.md | 5 +++ hugo.toml | 25 +++++++++++++++ i18n/en.toml | 2 +- i18n/fr.toml | 2 +- i18n/hi.toml | 2 +- i18n/zh-CN.toml | 2 +- i18n/zh-TW.toml | 2 +- layouts/partials/init/index.html | 2 +- layouts/partials/plugin/analytics.html | 43 ++++++++++++++++++++++++++ 10 files changed, 84 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c50d40905..b4c102d17 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,11 @@ I don't know why 🤷 - Optimized SEO performance with a correct **SEO SCHEMA** based on JSON-LD - **[Google Analytics](https://analytics.google.com/analytics)** supported - **[Fathom Analytics](https://usefathom.com/)** supported +- **[Baidu Analytics](https://tongji.baidu.com/)** supported +- **[Umami Analytics](https://umami.is/)** supported +- **[Plausible Analytics](https://plausible.io/)** supported +- **[Cloudflare Web Analytics](https://www.cloudflare.com/web-analytics)** supported +- **[Splitbee Analytics](https://splitbee.io)** supported - Search engine **verification** supported (Google, Bing, Yandex, Pinterest, Baidu, 360 and Sogou) - **CDN** for third-party libraries supported diff --git a/README.zh-cn.md b/README.zh-cn.md index 501887af2..d39b13d37 100644 --- a/README.zh-cn.md +++ b/README.zh-cn.md @@ -65,6 +65,11 @@ - 使用基于 JSON-LD 格式 的 **SEO SCHEMA** 文件进行 SEO 优化 - 支持 **[Google Analytics](https://analytics.google.com/analytics)** - 支持 **[Fathom Analytics](https://usefathom.com/)** +- 支持 **[百度统计](https://tongji.baidu.com/)** +- 支持 **[Umami Analytics](https://umami.is/)** +- 支持 **[Plausible Analytics](https://plausible.io/)** +- 支持 **[Cloudflare Web Analytics](https://www.cloudflare.com/web-analytics)** +- 支持 **[Splitbee Analytics](https://splitbee.io)** - 支持搜索引擎的**网站验证** (Google, Bing, Yandex, Pinterest, Baidu, 360 and Sogou) - 支持所有第三方库的 **CDN** diff --git a/hugo.toml b/hugo.toml index 9d7296258..2268c36a0 100644 --- a/hugo.toml +++ b/hugo.toml @@ -777,6 +777,31 @@ enableEmoji = true id = "" # server url for your tracker if you're self hosting server = "" + # FixIt 0.3.16 | NEW Baidu Analytics + [params.analytics.baidu] + id = "" + # FixIt 0.3.16 | NEW Umami Analytics + [params.analytics.umami] + data_website_id = "" + src = "" + data_host_url = "" + data_domains = "" + # FixIt 0.3.16 | NEW Plausible Analytics + [params.analytics.plausible] + data_domain = "" + src = "" + # FixIt 0.3.16 | NEW Cloudflare Analytics + [params.analytics.cloudflare] + token = "" + # FixIt 0.3.16 | NEW Splitbee Analytics + [params.analytics.splitbee] + enable = false + # no cookie mode + no_cookie = true + # respect the do not track setting of the browser + do_not_track = true + # token(optional), more info on https://splitbee.io/docs/embed-the-script + data_token = "" # Cookie consent config [params.cookieconsent] diff --git a/i18n/en.toml b/i18n/en.toml index 8af9099d3..2347e8e0b 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -6,7 +6,7 @@ configurationError = "Configuration Error\nYou haven't configured the FixIt version param correctly yet. See https://fixit.lruihao.cn/documentation/basics/#theme-configuration" compatibilityError = "Compatibility Error ({{ .From }} -> {{ .To }}):\nYou have an incompatible update. See https://github.com/hugo-fixit/FixIt/releases" devVersionWarn = "You are using a development version of FixIt. Please consider using a stable version.\nSee https://github.com/hugo-fixit/FixIt/releases" -devEnvWarn = "Current environment is \"development\". The \"comment system\", \"PWA\", \"CDN\" and \"fingerprint\" will be disabled." +devEnvWarn = "Current environment is \"development\". The \"comment system\", \"PWA\", \"CDN\", \"fingerprint\" and \"analytics\" will be disabled." quicklyUpgrade = "Quickly upgrade use command: " # === init === diff --git a/i18n/fr.toml b/i18n/fr.toml index a2a3b1154..3f6864051 100644 --- a/i18n/fr.toml +++ b/i18n/fr.toml @@ -7,7 +7,7 @@ configurationError = "Erreur de configuration\nVous n'avez pas configuré la version de FixIt correctement. Voir https://fixit.lruihao.cn/documentation/basics/#theme-configuration" compatibilityError = "Erreur de compatibilité ({{ .From }} -> {{ .To }}):\nVous avez une mise à jour incompatible. Voir https://github.com/hugo-fixit/FixIt/releases" devVersionWarn = "Vous utilisez une version de développement de FixIt. Veuillez considérer l'utilisation d'une version stable.\nVoir https://github.com/hugo-fixit/FixIt/releases" -devEnvWarn = "L'environnement actuel est \"développement\". Le \"système de commentaires\", le \"PWA\", le \"CDN\" et la \"prise d'empreinte\" seront désactivés." +devEnvWarn = "L'environnement actuel est \"développement\". Le \"système de commentaires\", le \"PWA\", le \"CDN\", le \"prise d'empreinte\" et la \"analyses\" seront désactivés." quicklyUpgrade = "La mise à jour rapide utilise la commande: " # === init === diff --git a/i18n/hi.toml b/i18n/hi.toml index 1ef3a376c..cd7deebc7 100644 --- a/i18n/hi.toml +++ b/i18n/hi.toml @@ -7,7 +7,7 @@ configurationError = "कन्फ़िग्यरेशन त्रुटि \nआपने फिक्सइट संस्करण पैरामीटर को सही ढंग से कॉन्फ़िगर नहीं किया है।. यह देखें: https://fixit.lruihao.cn/documentation/basics/#theme-configuration" compatibilityError = "संगतता त्रुटि ({{ .From }} -> {{ .To }}):\nआपके पास एक असंगत अपडेट है. यह देखें: https://github.com/hugo-fixit/FixIt/releases" devVersionWarn = "आप फिक्सइट के डिवेलपर संस्करण का उपयोग कर रहे हैं। कृपया एक स्थिर संस्करण का उपयोग करने पर विचार करें।\nयह देखें: https://github.com/hugo-fixit/FixIt/releases" -devEnvWarn = "वर्तमान परिवेश \"डिवेलप्मेंट\" का है। \"टिप्पणी प्रणाली\", \"पीडब्ल्यूए\", \"सीडीएन\" और \"फ़िंगरप्रिंट\" अक्षम कर दिए जाएंगे। " +devEnvWarn = "वर्तमान परिवेश \"डिवेलप्मेंट\" का है। \"टिप्पणी प्रणाली\", \"पीडब्ल्यूए\", \"सीडीएन\", \"फ़िंगरप्रिंट\" और \"विश्लेषण\" अक्षम कर दिए जाएंगे।" quicklyUpgrade = "शीघ्रता से अपग्रेड यह कमांड का उपयोग करें: " # === init === diff --git a/i18n/zh-CN.toml b/i18n/zh-CN.toml index 03524599f..9eab9a044 100644 --- a/i18n/zh-CN.toml +++ b/i18n/zh-CN.toml @@ -7,7 +7,7 @@ configurationError = "配置文件错误\n您还没有正确配置 FixIt 的版本参数。参考 https://fixit.lruihao.cn/zh-cn/documentation/basics/#theme-configuration" compatibilityError = "兼容性错误 ({{ .From }} -> {{ .To }}):\n您进行了一次不兼容的更新。参考 https://github.com/hugo-fixit/FixIt/releases" devVersionWarn = "您正在使用开发版的 FixIt,请考虑使用稳定版。\n见 https://github.com/hugo-fixit/FixIt/releases" -devEnvWarn = "当前运行环境是“development”。“评论系统”、“PWA”、“CDN”和“fingerprint”不会启用。" +devEnvWarn = "当前运行环境是“development”。“评论系统”、“PWA”、“CDN”、“fingerprint”和“统计”不会启用。" quicklyUpgrade = "使用命令快速升级:" # === init === diff --git a/i18n/zh-TW.toml b/i18n/zh-TW.toml index 6ee437bc1..eb2c63d82 100644 --- a/i18n/zh-TW.toml +++ b/i18n/zh-TW.toml @@ -7,7 +7,7 @@ configurationError = "配置文件錯誤\n您還沒有正確配置 FixIt 的版本參數。參考 https://fixit.lruihao.cn/zh-cn/documentation/basics/#theme-configuration" compatibilityError = "兼容性錯誤 ({{ .From }} -> {{ .To }}):\n您進行了一次不兼容的更新。参考 https://github.com/hugo-fixit/FixIt/releases" devVersionWarn = "您正在使用開發版的 FixIt,請考慮使用穩定版。\n見 https://github.com/hugo-fixit/FixIt/releases" -devEnvWarn = "當前運行環境是“development”。“評論系統”、“PWA”、“CDN”和“fingerprint”不會啟用。" +devEnvWarn = "當前運行環境是“development”。“評論系統”、“PWA”、“CDN”、“fingerprint”和“統計”不會啟用。" quicklyUpgrade = "使用命令快速升級:" # === init === diff --git a/layouts/partials/init/index.html b/layouts/partials/init/index.html index ca2116ef0..4122f9e78 100644 --- a/layouts/partials/init/index.html +++ b/layouts/partials/init/index.html @@ -1,4 +1,4 @@ -{{- .Scratch.Set "version" "v0.3.16-0ed41783" -}} +{{- .Scratch.Set "version" "v0.3.16-f1ba78ef" -}} {{- .Scratch.Set "this" dict -}} {{- partial "init/detection-env.html" . -}} diff --git a/layouts/partials/plugin/analytics.html b/layouts/partials/plugin/analytics.html index 58f9bf0b4..33c4edfee 100644 --- a/layouts/partials/plugin/analytics.html +++ b/layouts/partials/plugin/analytics.html @@ -19,4 +19,47 @@ {{- dict "Source" ($analytics.fathom.server | default "cdn.usefathom.com" | printf "https://%v/tracker.js") "Async" true "Attr" "id=fathom-script" | partial "plugin/script.html" -}} {{- end -}} + + {{- /* Baidu Analytics */ -}} + {{- with $analytics.baidu.id -}} + + {{- end -}} + + {{- /* Umami Analytics */ -}} + {{- with $analytics.umami.data_website_id -}} + + {{- end -}} + + {{- /* Plausible Analytics */ -}} + {{- with $analytics.plausible.data_domain -}} + + {{- end -}} + + {{- /* Cloudflare Analytics */ -}} + {{- with $analytics.cloudflare.token -}} + + {{- end -}} + + {{- /* Splitbee Analytics */ -}} + {{- if $analytics.splitbee.enable -}} + {{- $attr := "" -}} + {{- if $analytics.splitbee.do_not_track -}} + {{- $attr = printf `%v data-respect-dnt` $attr -}} + {{- end -}} + {{- if $analytics.splitbee.no_cookie -}} + {{- $attr = printf `%v data-no-cookie` $attr -}} + {{- end -}} + {{- with $analytics.splitbee.data_token -}} + {{- $attr = printf `%v data-token="%v"` $attr . -}} + {{- end -}} + + {{- end -}} {{- end -}} From 38b681cdfe93a2526e09788f3a2ef458deef0714 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Wed, 27 Nov 2024 10:44:58 +0800 Subject: [PATCH 11/25] :memo: Docs: update README --- README.md | 16 ++++++++-------- README.zh-cn.md | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index b4c102d17..29dd7bc5e 100644 --- a/README.md +++ b/README.md @@ -35,12 +35,12 @@ Outline: [Installation](https://fixit.lruihao.cn/documentation/installation/) Click the following links to generate a new repository with template: -| Template repository | Generate link | -| :----------------------------------------- | :----------------------------: | -| [hugo-fixit/hugo-fixit-starter][starter] | [Click][starter:generate] | -| [hugo-fixit/hugo-fixit-starter1][starter1] | [Click][starter1:generate] | -| [hugo-fixit/docs][docs] | [Click][docs:generate] | -| [Lruihao/hugo-blog][lruihao-blog] | [Click][lruihao-blog:generate] | +| Template | repository | Generate link | +| :-------------------------------------------- | :-------------------------------- | :----------------------------: | +| A quick-start template base on Hugo Modules. | [hugo-fixit-starter][starter] | [Click][starter:generate] | +| A quick-start template base on Git submodule. | [hugo-fixit-starter1][starter1] | [Click][starter1:generate] | +| Build multilingual sites using Fixit theme. | [docs][docs] | [Click][docs:generate] | +| Customize with FixIt theme. | [Lruihao/hugo-blog][lruihao-blog] | [Click][lruihao-blog:generate] | [starter]: https://github.com/hugo-fixit/hugo-fixit-starter [starter:generate]: https://github.com/hugo-fixit/hugo-fixit-starter/generate @@ -248,8 +248,8 @@ FixIt is licensed under the **MIT** license. Check the [LICENSE file](/LICENSE) If you enjoy the theme, please consider buying me a coffee ☕️. Thanks! -- [Wechat](images/wechatpay.jpg) -- [Alipay](images/alipay.jpg) +- [Wechat](/images/wechatpay.jpg) +- [Alipay](/images/alipay.jpg) - [PayPal](https://paypal.me/Lruihao) ## Author diff --git a/README.zh-cn.md b/README.zh-cn.md index d39b13d37..9dc3bea35 100644 --- a/README.zh-cn.md +++ b/README.zh-cn.md @@ -35,12 +35,12 @@ 点击以下链接使用模板生成一个新的仓库: -| 模板仓库 | 生成链接 | -| :----------------------------------------- | :-------------------------------: | -| [hugo-fixit/hugo-fixit-starter][starter] | [点击生成][starter:generate] | -| [hugo-fixit/hugo-fixit-starter1][starter1] | [点击生成][starter1:generate] | -| [hugo-fixit/docs][docs] | [点击生成][docs:generate] | -| [Lruihao/hugo-blog][lruihao-blog] | [点击生成][lruihao-blog:generate] | +| 模板 | 仓库 | 生成链接 | +| :---------------------------------- | :-------------------------------- | :-------------------------------: | +| 基于 Hugo Modules 的快速入门模板。 | [hugo-fixit-starter][starter] | [点击生成][starter:generate] | +| 基于 Git submodule 的快速入门模板。 | [hugo-fixit-starter1][starter1] | [点击生成][starter1:generate] | +| 使用 Fixit 主题构建多语言网站。 | [docs][docs] | [点击生成][docs:generate] | +| 基于 FixIt 主题进行自定义设置。 | [Lruihao/hugo-blog][lruihao-blog] | [点击生成][lruihao-blog:generate] | [starter]: https://github.com/hugo-fixit/hugo-fixit-starter [starter:generate]: https://github.com/hugo-fixit/hugo-fixit-starter/generate @@ -252,8 +252,8 @@ FixIt 根据 **MIT** 许可协议授权。更多信息请查看 [LICENSE 文件] 如果你喜爱这个主题,请考虑给我买杯咖啡 ☕️,谢谢! -- [微信支付](images/wechatpay.jpg) -- [支付宝](images/alipay.jpg) +- [微信支付](/images/wechatpay.jpg) +- [支付宝](/images/alipay.jpg) - [PayPal](https://paypal.me/Lruihao) ## 作者 From 168f1babc3e74c7501730fa61e970f55f96813d1 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Wed, 27 Nov 2024 16:20:21 +0800 Subject: [PATCH 12/25] :sparkles: Feat: add page layout "search" --- hugo.toml | 11 ++++++++++- layouts/page/search.html | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 layouts/page/search.html diff --git a/hugo.toml b/hugo.toml index 2268c36a0..04554ccfe 100644 --- a/hugo.toml +++ b/hugo.toml @@ -389,7 +389,7 @@ enableEmoji = true # Search config [params.search] enable = false - # type of search engine ["algolia", "fuse"] + # type of search engine ["algolia", "fuse", "cse"] type = "fuse" # max index length of the chunked content contentLength = 4000 @@ -418,6 +418,15 @@ enableEmoji = true ignoreLocation = false useExtendedSearch = false ignoreFieldNorm = false + # FixIt 0.3.16 | NEW Custom Search Engine (CSE) + [params.search.cse] + # support cse engine: ["google", "bing"] + engine = "google" + # Google: https://programmablesearchengine.google.com/ + # Google Custom Search Engine Context + cx = "" + # Bing: https://www.customsearch.ai/ + # TODO # Header config [params.header] diff --git a/layouts/page/search.html b/layouts/page/search.html new file mode 100644 index 000000000..04b974849 --- /dev/null +++ b/layouts/page/search.html @@ -0,0 +1,37 @@ +{{- /* + TODO Adapting to dark mode, maybe use css variables +*/ -}} +{{- define "title" -}} + {{- cond (.Param "capitalizeTitles") (title .Title) .Title -}} + {{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}} +{{- end -}} + +{{- define "content" -}} + {{- $params := partial "function/params.html" -}} + {{- $cse := .Site.Params.search.cse -}} +
+
+ {{- /* Title */ -}} +

{{- cond (.Param "capitalizeTitles") (title .Title) .Title -}}

+ + {{- /* Subtitle */ -}} + {{- with $params.subtitle -}}

{{ . | $.RenderString }}

{{- end -}} +
+ + {{- /* Content */ -}} +
+ {{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}} +
+ + {{- /* Google CSE */ -}} + {{- if eq $cse.engine "google" -}} + {{- with $cse.cx -}} + + +
+ {{- end -}} + {{- end -}} + + {{- /* TODO Bing CSE */ -}} +
+{{- end -}} From 4886c053958eb3613e40cf011abaab301d0da4f4 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Wed, 27 Nov 2024 17:02:06 +0800 Subject: [PATCH 13/25] :lipstick: Style: update search layout page style --- assets/css/_core/_header.scss | 2 +- assets/css/_page/_index.scss | 1 - assets/css/_page/_special.scss | 6 ------ assets/css/_page/{ => _special}/_friends.scss | 2 +- assets/css/_page/_special/_index.scss | 14 ++++++++++++++ assets/css/_page/_special/_search.scss | 9 +++++++++ hugo.toml | 5 ++--- layouts/page/search.html | 4 ++-- 8 files changed, 29 insertions(+), 14 deletions(-) delete mode 100644 assets/css/_page/_special.scss rename assets/css/_page/{ => _special}/_friends.scss (96%) create mode 100644 assets/css/_page/_special/_index.scss create mode 100644 assets/css/_page/_special/_search.scss diff --git a/assets/css/_core/_header.scss b/assets/css/_core/_header.scss index 80522e0f9..a231c86f6 100644 --- a/assets/css/_core/_header.scss +++ b/assets/css/_core/_header.scss @@ -118,7 +118,7 @@ header { } } -.search { +.menu .search { position: relative; input { diff --git a/assets/css/_page/_index.scss b/assets/css/_page/_index.scss index 6ac5e31c7..4d326c034 100644 --- a/assets/css/_page/_index.scss +++ b/assets/css/_page/_index.scss @@ -17,4 +17,3 @@ @import '_home'; @import '_404'; @import '_offline'; -@import '_friends'; diff --git a/assets/css/_page/_special.scss b/assets/css/_page/_special.scss deleted file mode 100644 index 3a8f18d26..000000000 --- a/assets/css/_page/_special.scss +++ /dev/null @@ -1,6 +0,0 @@ -.special { - .single-title, - .single-subtitle { - text-align: right; - } -} diff --git a/assets/css/_page/_friends.scss b/assets/css/_page/_special/_friends.scss similarity index 96% rename from assets/css/_page/_friends.scss rename to assets/css/_page/_special/_friends.scss index 5d0dce1a0..25738af92 100644 --- a/assets/css/_page/_friends.scss +++ b/assets/css/_page/_special/_friends.scss @@ -1,5 +1,5 @@ /** - * @Description: Style of layout named 'friends'. + * Style of layout named 'friends'. * @Author: Lruihao * @Updated: 2022/3/11 21:36 */ diff --git a/assets/css/_page/_special/_index.scss b/assets/css/_page/_special/_index.scss new file mode 100644 index 000000000..090bcd811 --- /dev/null +++ b/assets/css/_page/_special/_index.scss @@ -0,0 +1,14 @@ +.special { + .single-title, + .single-subtitle { + text-align: right; + } + + &.friends { + @import '_friends'; + } + + &.search { + @import '_search'; + } +} diff --git a/assets/css/_page/_special/_search.scss b/assets/css/_page/_special/_search.scss new file mode 100644 index 000000000..6ae555881 --- /dev/null +++ b/assets/css/_page/_special/_search.scss @@ -0,0 +1,9 @@ +// Style of layout named 'search' + +// Google CSE +.gcse-searchbox:empty, +.gcse-searchresults:empty { + display: none; +} + +// Bing CSE (Unsupported) diff --git a/hugo.toml b/hugo.toml index 04554ccfe..dab6f2415 100644 --- a/hugo.toml +++ b/hugo.toml @@ -420,13 +420,12 @@ enableEmoji = true ignoreFieldNorm = false # FixIt 0.3.16 | NEW Custom Search Engine (CSE) [params.search.cse] - # support cse engine: ["google", "bing"] + # CSE engine: ["google", "bing"] engine = "google" # Google: https://programmablesearchengine.google.com/ # Google Custom Search Engine Context cx = "" - # Bing: https://www.customsearch.ai/ - # TODO + # Bing (Unsupported): https://www.customsearch.ai/ # Header config [params.header] diff --git a/layouts/page/search.html b/layouts/page/search.html index 04b974849..9c741fd1e 100644 --- a/layouts/page/search.html +++ b/layouts/page/search.html @@ -9,7 +9,7 @@ {{- define "content" -}} {{- $params := partial "function/params.html" -}} {{- $cse := .Site.Params.search.cse -}} -
+ {{- end -}} From 6a04876258d968753a149173952cbe062bd406ca Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Wed, 27 Nov 2024 17:53:29 +0800 Subject: [PATCH 14/25] :memo: Docs: add search archetype command: hugo new content search/index.md --- archetypes/search.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 archetypes/search.md diff --git a/archetypes/search.md b/archetypes/search.md new file mode 100644 index 000000000..3489fa5ad --- /dev/null +++ b/archetypes/search.md @@ -0,0 +1,5 @@ +--- +title: {{ T "assets.search" }} +layout: search +date: {{ .Date }} +--- From 46edabd81a22ca4101b3bf7a963a4e75be5c99c2 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Wed, 27 Nov 2024 17:55:43 +0800 Subject: [PATCH 15/25] :memo: Chore: add todo comments --- assets/css/_page/_special/_search.scss | 1 + layouts/page/search.html | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/assets/css/_page/_special/_search.scss b/assets/css/_page/_special/_search.scss index 6ae555881..6b6c9e6f3 100644 --- a/assets/css/_page/_special/_search.scss +++ b/assets/css/_page/_special/_search.scss @@ -1,4 +1,5 @@ // Style of layout named 'search' +// TODO Adapting to dark mode, maybe use css variables // Google CSE .gcse-searchbox:empty, diff --git a/layouts/page/search.html b/layouts/page/search.html index 9c741fd1e..1eeb2ee0f 100644 --- a/layouts/page/search.html +++ b/layouts/page/search.html @@ -1,6 +1,3 @@ -{{- /* - TODO Adapting to dark mode, maybe use css variables -*/ -}} {{- define "title" -}} {{- cond (.Param "capitalizeTitles") (title .Title) .Title -}} {{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}} From eca4fa405784c1a4bb80aa3f9964f4a2524ff106 Mon Sep 17 00:00:00 2001 From: Giovanna Souza Teodoro Date: Wed, 27 Nov 2024 20:19:46 -0400 Subject: [PATCH 16/25] =?UTF-8?q?=F0=9F=9A=A7=20Fix:=20add=20content=20in?= =?UTF-8?q?=20pt-BR.toml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/pt-BR.toml | 110 ++++++++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/i18n/pt-BR.toml b/i18n/pt-BR.toml index 00ac15c86..c4e413bb5 100644 --- a/i18n/pt-BR.toml +++ b/i18n/pt-BR.toml @@ -1,27 +1,26 @@ # Translations for Brazilian Portuguese # Tradução para português do Brasil # https://gohugo.io/content-management/multilingual/#translation-of-strings -# TODO Some fields are waiting for your translation # === init === [init] -configurationError = "" -compatibilityError = "" -devVersionWarn = "" -devEnvWarn = "" -quicklyUpgrade = "" +configurationError = "Erro de configuração\nVocê ainda não configurou o parâmetro da versão do FixIt corretamente. Consulte https://fixit.lruihao.cn/documentation/basics/#theme-configuration" +compatibilityError = "Erro de compatibilidade ({{ .From }} -> {{ .To }}):\nVocê tem uma atualização incompatível. Consulte https://github.com/hugo-fixit/FixIt/releases" +devVersionWarn = "Você está usando a versão de desenvolvedor do FixIt. Por favor, use uma versão estável. \nConsulte https://github.com/hugo-fixit/FixIt/releases" +devEnvWarn = "O ambiente atual é \"development\". O \"comment system\", \"PWA\", \"CDN\", \"fingerprint\" e \"analytics\" serão desativados." +quicklyUpgrade = "Utilize o comando para atualizar rapidamente:" # === init === # === baseof === [baseof] backToTop = "Voltar ao topo" viewComments = "Ver comentários" -noscript = "" +noscript = "Este site funciona melhor com o JavaScript ativado." # === baseof === # === Taxonomy === [archives] -other = "" +other = "Arquivos" [allSome] other = "{{ .Some }}" @@ -33,10 +32,10 @@ other = "Categoria" other = "Categorias" [collection] -other = "" +other = "Coleção" [collections] -other = "" +other = "Coleções" [tag] other = "Tag" @@ -46,6 +45,7 @@ other = "Tags" [posts] other = "Posts" + # === Taxonomy === # === Section === @@ -53,12 +53,12 @@ other = "Posts" recentlyUpdated = "Recentemente atualizado" [section.totalWordCount] -one = "" -other = "" +one = "Apenas uma palavra" +other = "Total de {{ .Count }} palavras" [section.archiveCounter] -one = "" -other = "" +one = "Apenas um artigo" +other = "{{ .Count }} artigos no total" # === Section === # === Pagination === @@ -75,86 +75,86 @@ switchTheme = "Trocar tema" # === partials/footer.html === [footer] -poweredBySome = "Possibilitado por {{ .Hugo }} | Tema - {{ .Theme }}" +poweredBySome = "Criado com {{ .Hugo }} | Tema - {{ .Theme }}" siteUV = "Total de visitantes" sitePV = "Total de visitas" -siteRunning = "Website running ..." +siteRunning = "Site no ar..." # === partials/footer.html === # === partials/comment.html === [comment] valineLang = "en" # Valine não suporta português -valinePlaceholder = "O seu comentário ..." +valinePlaceholder = "O seu comentário..." facebookLanguageCode = "pt_BR" # === partials/comment.html === # === partials/assets.html === [assets] search = "Pesquisa" -searchPlaceholder = "Pesquisar títulos ou conteúdos ..." +searchPlaceholder = "Pesquisar títulos ou conteúdos..." clear = "Limpar" cancel = "Cancelar" noResultsFound = "Nenhum resultado encontrado" copyToClipboard = "Copiar para a área de transferência" editLockTitle = "Bloquear bloco de código editável" -editUnLockTitle = "Desbloqueie o bloco de código editável" +editUnLockTitle = "Desbloquear o bloco de código editável" cookieconsentMessage = "Este site usa Cookies para melhorar sua experiência." -cookieconsentDismiss = "Aceita" +cookieconsentDismiss = "Aceitar" cookieconsentLink = "Saber mais" # === partials/assets.html === # === partials/plugin/share.html === [shareOn] -other = "Compartilhe em" +other = "Compartilhar em" # === partials/plugin/share.html === # === posts/single.html === [single] contents = "Conteúdos" -pin = "" -repost = "" +pin = "Fixar no topo" +repost = "Repostar" publishedOnDate = "publicado em {{ .Date }}" views = "visualizações" comments = "comentários" author = "Autor" updatedOnDate = "Atualizado em {{ .Date }}" readMarkdown = "Leia em Markdown" -viewSource = "" +viewSource = "Ver a fonte" editThisPage = "Editar esta página" -reportIssue = "" +reportIssue = "Reportar problema" back = "Voltar" home = "Home" readMore = "Leia mais" expirationReminder = "Este artigo foi atualizado pela última vez em {{ .Date }}, o conteúdo pode estar desatualizado." -encryptedAbstract = "" -encryptedMessage = "" -password = "Contrasinha" -enterBtn = "" -encryptyAgain = "" +encryptedAbstract = "Este artigo foi encriptado, então seu contéudo bruto é invisível!" +encryptedMessage = "Por favor, insira a senha" +password = "Senha" +enterBtn = "Entrar" +encryptyAgain = "Encripte novamente" relatedContent = "Conteúdo relacionado" [single.includedIn] -categories = "incluido em {{ .Categories }}" -collections = "incluido em {{ .Collections }}" -both = "incluido em {{ .Categories }} e {{ .Collections }}" +categories = "incluído em {{ .Categories }}" +collections = "incluído em {{ .Collections }}" +both = "incluído em {{ .Categories }} e {{ .Collections }}" [single.wordCount] one = "Uma palavra" other = "{{ .Count }} palavras" [single.fuzzyWordCount] -other = "" +other = "Cerca de {{ .Count }} palavras" [single.readingTime] one = "Um minuto" other = "{{ .Count }} minutos" [single.reward] -donate = "" -wechatpay = "" -alipay = "" -paypal = "" -bitcoin = "" +donate = "Doe" +wechatpay = "Pague pelo WeChat" +alipay = "Alipay" +paypal = "PayPal" +bitcoin = "Bitcoin" # === posts/single.html === # === 404.html === @@ -162,7 +162,7 @@ bitcoin = "" other = "Página não encontrada" [pageNotFoundText] -other = "A página que você procura não existe. Desculpe" +other = "A página que você procura não existe. Desculpe." # === 404.html === # === offline === @@ -175,34 +175,34 @@ other = "Você não está conectado à Internet, apenas as páginas em cache est # === GitHub Alert === [alert] -note = "" -tip = "" -important = "" -warning = "" -caution = "" +note = "Nota" +tip = "Sugestão" +important = "Importante" +warning = "Aviso" +caution = "Cuidado" # === GitHub Alert === # === Task lists === [taskList] -" " = "" -"x" = "" -"/" = "" -"-" = "" -"<" = "" -">" = "" -"!" = "" -"?" = "" +" " = "Não verificado" +"x" = "Verificado" +"/" = "Em progresso" +"-" = "Cancelado" +"<" = "Agendado" +">" = "Reagendado" +"!" = "Importante" +"?" = "Dúvida" # === Task lists === # === shortcodes/admonition.html === [admonition] note = "Nota" -abstract = "Abstrato" +abstract = "Resumo" info = "Info" todo = "A fazer" tip = "Dica" success = "Sucesso" -question = "Pergunta" +question = "Dúvida" warning = "Aviso" failure = "Falha" danger = "Perigo" From ec9a544f0490049188dc1d2722e36f5fecc978fa Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Thu, 28 Nov 2024 11:23:35 +0800 Subject: [PATCH 17/25] :sparkles: Feat: add Google CSE support --- assets/js/theme.js | 50 ++++++++++++++++++++++++++---------- hugo.toml | 19 +++++++++----- layouts/page/search.html | 4 +-- layouts/partials/assets.html | 10 ++++++++ 4 files changed, 61 insertions(+), 22 deletions(-) diff --git a/assets/js/theme.js b/assets/js/theme.js index fecdb263a..fb33748b6 100644 --- a/assets/js/theme.js +++ b/assets/js/theme.js @@ -159,8 +159,10 @@ class FixIt { document.body.classList.add('blur'); $header.classList.add('open'); $searchInput.focus(); + this.disableScrollEvent = true; }, false); $searchClear.addEventListener('click', () => { + this.disableScrollEvent = false; $searchClear.style.display = 'none'; this._searchDesktop && this._searchDesktop.autocomplete.setVal(''); }, false); @@ -289,25 +291,47 @@ class FixIt { finish([]); }); } else finish(search()); - } + } else if (searchConfig.type === 'cse') { + const cseConfig = this.config.cse; + if (cseConfig.engine === 'google' && cseConfig.cx) { + finish([{ + uri: `${cseConfig.resultsPage}#gsc.tab=0&gsc.q=${encodeURIComponent(query)}`, + title: cseConfig.searchIn, + date: '', + context: cseConfig.gotoResultsPage + }]); + } + } }, templates: { suggestion: ({ title, date, context }) => `
${title}${date}
${context}
`, empty: ({ query }) => `
${searchConfig.noResultsFound}: "${query}"
`, footer: ({}) => { - const { searchType, icon, href } = - searchConfig.type === 'algolia' - ? { - searchType: 'algolia', - icon: '', - href: 'https://www.algolia.com/' - } - : { - searchType: 'Fuse.js', - icon: '', - href: 'https://fusejs.io/' - } + let searchType, icon, href; + switch (searchConfig.type) { + case 'algolia': + searchType = 'algolia'; + icon = ''; + href = 'https://www.algolia.com/'; + break; + case 'fuse': + searchType = 'Fuse.js'; + icon = ''; + href = 'https://fusejs.io/'; + break; + case 'cse': + if (this.config.cse.engine === 'google') { + searchType = 'Google CSE'; + icon = ''; + href = 'https://programmablesearchengine.google.com/'; + } + break; + default: + searchType = ''; + icon = ''; + href = ''; + } return ``; } } diff --git a/hugo.toml b/hugo.toml index dab6f2415..ef0b7e227 100644 --- a/hugo.toml +++ b/hugo.toml @@ -418,14 +418,19 @@ enableEmoji = true ignoreLocation = false useExtendedSearch = false ignoreFieldNorm = false - # FixIt 0.3.16 | NEW Custom Search Engine (CSE) - [params.search.cse] - # CSE engine: ["google", "bing"] - engine = "google" - # Google: https://programmablesearchengine.google.com/ - # Google Custom Search Engine Context + + # FixIt 0.3.16 | NEW Custom Search Engine (CSE) + [params.cse] + # Search Engine: ["google", "bing"] + engine = "" + # Search results page URL (layout: search) + resultsPage = "/search/" + # Google: https://programmablesearchengine.google.com/ + # Google Custom Search Engine Context + [params.cse.google] cx = "" - # Bing (Unsupported): https://www.customsearch.ai/ + # Bing (Unsupported): https://www.customsearch.ai/ + [params.cse.bing] # Header config [params.header] diff --git a/layouts/page/search.html b/layouts/page/search.html index 1eeb2ee0f..148fc177e 100644 --- a/layouts/page/search.html +++ b/layouts/page/search.html @@ -5,7 +5,7 @@ {{- define "content" -}} {{- $params := partial "function/params.html" -}} - {{- $cse := .Site.Params.search.cse -}} + {{- $cse := .Site.Params.cse -}}