From 4b9e63fd99da2227b5fa16b4234828d40afa60a6 Mon Sep 17 00:00:00 2001 From: ZhenShuo Leo <98386542+ZhenShuo2021@users.noreply.github.com> Date: Thu, 18 Sep 2025 04:13:06 +0800 Subject: [PATCH] feat(article-link): add support for `hotlinkFeatureImages` --- config/_default/params.toml | 1 + exampleSite/config/_default/params.toml | 1 + .../content/docs/configuration/index.it.md | 1 + .../content/docs/configuration/index.ja.md | 1 + .../content/docs/configuration/index.md | 1 + .../content/docs/configuration/index.zh-cn.md | 1 + layouts/_default/baseof.html | 1 + layouts/partials/article-link/_shortcode.html | 63 +++++++++++++------ .../partials/article-link/card-related.html | 57 +++++++++++------ layouts/partials/article-link/card.html | 57 +++++++++++------ layouts/partials/article-link/simple.html | 57 +++++++++++------ layouts/partials/init.html | 34 ++++++++++ 12 files changed, 199 insertions(+), 76 deletions(-) create mode 100644 layouts/partials/init.html diff --git a/config/_default/params.toml b/config/_default/params.toml index 7f3abf80..c42f194a 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -26,6 +26,7 @@ disableTextInHeader = false # defaultBackgroundImage = "IMAGE.jpg" # used as default for background images # defaultFeaturedImage = "IMAGE.jpg" # used as default for featured images in all articles # defaultSocialImage = "/android-chrome-512x512.png" # used as default for social media sharing (Open Graph and Twitter) +hotlinkFeatureImages = false # highlightCurrentMenuArea = true # smartTOC = true diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index 80196217..c075927e 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -26,6 +26,7 @@ disableTextInHeader = false defaultBackgroundImage = "/img/background.svg" defaultFeaturedImage = "/img/featured.svg" defaultSocialImage = "/img/blowfish_banner.png" +hotlinkFeatureImages = false highlightCurrentMenuArea = true smartTOC = true diff --git a/exampleSite/content/docs/configuration/index.it.md b/exampleSite/content/docs/configuration/index.it.md index 270ebfd5..ce09b474 100644 --- a/exampleSite/content/docs/configuration/index.it.md +++ b/exampleSite/content/docs/configuration/index.it.md @@ -185,6 +185,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `defaultBackgroundImage` | _Not set_ | Default background image for both `background` homepage layout and `background` hero style | | `defaultFeaturedImage` | _Not set_ | Default background image for all `featured` images across articles, will be overridden by a local `featured` image. | | `defaultSocialImage` | _Not set_ | Default image for social media sharing (Open Graph and Twitter). Will be overridden by a local `feature` image if available. | +| `hotlinkFeatureImages` | `false` | Hotlink external images in article feature images and article cards. Those images will not be processed by Hugo. | | `highlightCurrentMenuArea` | _Not set_ | Marks menu entries in the main menu when selected | | `smartTOC` | _Not set_ | Activate smart Table of Contents, items in view will be highlighted. | | `smartTOCHideUnfocusedChildren` | _Not set_ | When smart Table of Contents is turned on, this will hide deeper levels of the table when they are not in focus. | diff --git a/exampleSite/content/docs/configuration/index.ja.md b/exampleSite/content/docs/configuration/index.ja.md index 9a8adc9f..1f052649 100644 --- a/exampleSite/content/docs/configuration/index.ja.md +++ b/exampleSite/content/docs/configuration/index.ja.md @@ -185,6 +185,7 @@ Blowfish は、テーマの機能を制御する多数の設定パラメータ | `defaultBackgroundImage` | _未設定_ | `background` ホームページレイアウトと `background` ヒーロースタイルの両方のデフォルトの背景画像です。 | | `defaultFeaturedImage` | _未設定_ | 記事全体のすべての `featured` 画像のデフォルトの背景画像です。ローカルの `featured` 画像によってオーバーライドされます。 | | `defaultSocialImage` | _未設定_ | ソーシャルメディア共有(Open Graph と Twitter)用のデフォルト画像。ローカルの `featured` 画像によってオーバーライドされます。 | +| `hotlinkFeatureImages` | `false` | 記事のアイキャッチ画像や記事カードで外部画像をホットリンクします。これらの画像は Hugo によって処理されません。 | | `highlightCurrentMenuArea` | _未設定_ | メインメニューのメニュー項目が選択されているときにマークを付けます。 | | `smartTOC` | _未設定_ | スマート目次をアクティブにします。表示されている項目が強調表示されます。 | | `smartTOCHideUnfocusedChildren` | _未設定_ | スマート目次がオンになっている場合、フォーカスされていないときに、テーブルのより深いレベルが非表示になります。 | diff --git a/exampleSite/content/docs/configuration/index.md b/exampleSite/content/docs/configuration/index.md index 092526a0..cd39d4a1 100644 --- a/exampleSite/content/docs/configuration/index.md +++ b/exampleSite/content/docs/configuration/index.md @@ -191,6 +191,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `defaultBackgroundImage` | _Not set_ | Default background image for both `background` homepage layout and `background` hero style | | `defaultFeaturedImage` | _Not set_ | Default background image for all `featured` images across articles, will be overridden by a local `featured` image. | | `defaultSocialImage` | _Not set_ | Default image for social media sharing (Open Graph and Twitter). Will be overridden by a local `feature` image. | +| `hotlinkFeatureImages` | `false` | Hotlink external images in article feature images and article cards. Those images will not be processed by Hugo. | | `highlightCurrentMenuArea` | _Not set_ | Marks menu entries in the main menu when selected | | `smartTOC` | _Not set_ | Activate smart Table of Contents, items in view will be highlighted. | | `smartTOCHideUnfocusedChildren` | _Not set_ | When smart Table of Contents is turned on, this will hide deeper levels of the table when they are not in focus. | diff --git a/exampleSite/content/docs/configuration/index.zh-cn.md b/exampleSite/content/docs/configuration/index.zh-cn.md index 74425b8b..740ff503 100644 --- a/exampleSite/content/docs/configuration/index.zh-cn.md +++ b/exampleSite/content/docs/configuration/index.zh-cn.md @@ -189,6 +189,7 @@ Blowfish 提供了大量控制主题功能的配置参数,下面的表格中 | `defaultBackgroundImage` | 无 | 设置默认背景图,用于 `background` 和 `hero` 布局下的主页。 | | `defaultFeaturedImage` | 无 | 设置默认背景图片,用于所有文章的`featured`图片,可以通过文章目录中的 `featured` 图片替换。 | | `defaultSocialImage` | 无 | 社交媒体分享(Open Graph 和 Twitter)使用的默认图片,可以通过文章目录中的 `featured` 图片替换。 | +| `hotlinkFeatureImages` | `false` | 在文章特色图片和文章卡片中外链图片。这些图片不会被 Hugo 处理。 | | `highlightCurrentMenuArea` | 无 | 当菜单被选择时,标记主菜单中的菜单项。 | | `smartTOC` | 无 | 开启智能目录,视图中的项目将会被高亮显示。 | | `smartTOCHideUnfocusedChildren` | 无 | 当开启智能目录,如果目录级别不再被聚焦时,将会隐藏更深层次的目录。 | diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 40965c04..49a60051 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -6,6 +6,7 @@ data-default-appearance="{{ site.Params.defaultAppearance | default `light` }}" data-auto-appearance="{{ site.Params.autoSwitchAppearance | default `true` }}"> {{- partial "head.html" . -}} + {{- partialCached "init.html" . -}}