Merge pull request #2166 from ZhenShuo2021/feat/image-option

 Feat: add new option disableImageOptimizationMD
This commit is contained in:
Nuno Coração
2025-05-27 00:37:23 +01:00
committed by GitHub
6 changed files with 11 additions and 6 deletions

View File

@@ -18,6 +18,7 @@ mainSections = ["docs"]
# robots = ""
disableImageOptimization = false
disableImageOptimizationMD = false
disableTextInHeader = false
# backgroundImageWidth = 1200

View File

@@ -177,7 +177,8 @@ Many of the article defaults here can be overridden on a per article basis by sp
| `showLikes` | _Not set_ | Whether or not articles and list likes are displayed. This requires firebase integrations to be enabled, look below. |
| `robots` | _Not set_ | String that indicates how robots should handle your site. If set, it will be output in the page head. Refer to [Google's docs](https://developers.google.com/search/docs/advanced/robots/robots_meta_tag#directives) for valid values. |
| `disableImageZoom` | `false` | Disables image zoom feature across all the images in the site. |
| `disableImageOptimization` | `false` | Disables image resize and optimization features across all the images in the site. |
| `disableImageOptimization` | `false` | Disables image resize and optimization features across all the images in the site, except images using markdown syntax (`![](image.jpg)`) |
| `disableImageOptimizationMD` | `false` | Disables image resize and optimization features only for images using markdown syntax (`![](image.jpg)`). |
| `disableTextInHeader` | `false` | Disables text in header, useful for logo based headers. |
| `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. |

View File

@@ -177,7 +177,8 @@ Blowfish は、テーマの機能を制御する多数の設定パラメータ
| `showLikes` | _未設定_ | 記事とリストのいいねを表示するかどうかです。これには Firebase 統合を有効にする必要があります。以下をご覧ください。 |
| `robots` | _未設定_ | ロボットがサイトをどのように処理するかを示す文字列です。設定されている場合、ページヘッダーに出力されます。有効な値については、[Google のドキュメント](https://developers.google.com/search/docs/advanced/robots/robots_meta_tag#directives)を参照してください。 |
| `disableImageZoom` | `false` | サイト内のすべての画像の画像ズーム機能を無効にします。 |
| `disableImageOptimization` | `false` | サイト内のすべての画像の画像サイズ変更と最適化機能を無効にします。 |
| `disableImageOptimization` | `false` | サイト内のすべての画像の画像サイズ変更と最適化機能を無効にします。Markdown 記法(例:`![](image.jpg)`)の画像は対象外です。 |
| `disableImageOptimizationMD` | `false` | Markdown 記法(例:`![](image.jpg)`)の画像の画像サイズ変更と最適化機能のみを無効にします。他の画像には適用されます。 |
| `disableTextInHeader` | `false` | ヘッダーのテキストを無効にします。ロゴベースのヘッダーに役立ちます。 |
| `defaultBackgroundImage` | _未設定_ | `background` ホームページレイアウトと `background` ヒーロースタイルの両方のデフォルトの背景画像です。 |
| `defaultFeaturedImage` | _未設定_ | 記事全体のすべての `featured` 画像のデフォルトの背景画像です。ローカルの `featured` 画像によってオーバーライドされます。 |

View File

@@ -182,7 +182,8 @@ Many of the article defaults here can be overridden on a per article basis by sp
| `showLikes` | _Not set_ | Whether or not articles and list likes are displayed. This requires firebase integrations to be enabled, look below. |
| `robots` | _Not set_ | String that indicates how robots should handle your site. If set, it will be output in the page head. Refer to [Google's docs](https://developers.google.com/search/docs/advanced/robots/robots_meta_tag#directives) for valid values. |
| `disableImageZoom` | `false` | Disables image zoom feature across all the images in the site. |
| `disableImageOptimization` | `false` | Disables image resize and optimization features across all the images in the site. |
| `disableImageOptimization` | `false` | Disables image resize and optimization features across all the images in the site, except images using markdown syntax (`![](image.jpg)`) |
| `disableImageOptimizationMD` | `false` | Disables image resize and optimization features only for images using markdown syntax (`![](image.jpg)`). |
| `backgroundImageWidth` | `1200` | Width (in pixels) to scale background images to. |
| `disableTextInHeader` | `false` | Disables text in header, useful for logo based headers. |
| `defaultBackgroundImage` | _Not set_ | Default background image for both `background` homepage layout and `background` hero style |

View File

@@ -180,7 +180,8 @@ Blowfish 提供了大量控制主题功能的配置参数,下面的表格中
| `showLikes` | 无 | 是否显示文章和列表页面的点赞量。这需要集成 firebase ,具体可以看下面。 |
| `robots` | 无 | 用于支持搜索引擎爬虫如何处理你的网站。如果设置了该值,它将被输出在页面头部。具体的参数值请参考 [Google 文档](https://developers.google.com/search/docs/advanced/robots/robots_meta_tag#directives)。 |
| `disableImageZoom` | `false` | 禁用网站上所有图片缩放功能。 |
| `disableImageOptimization` | `false` | 禁用图片上所有图片的调整大小和优化功能 |
| `disableImageOptimization` | `false` | 禁用图片上所有图片的调整大小和优化功能,使用 Markdown 语法插入的图片(`![](image.jpg)`)除外。 |
| `disableImageOptimizationMD` | `false` | 所有以 Markdown 语法(`![](image.jpg)`)插入的图片,禁用其调整大小和优化功能。 |
| `backgroundImageWidth` | `1200` | 宽度(以像素为单位)用于缩放背景图像。 |
| `disableTextInHeader` | `false` | 禁用文本类型的标题,对基于 logo 的标题很有用。 |
| `defaultBackgroundImage` | 无 | 设置默认背景图,用于 `background``hero` 布局下的主页。 |

View File

@@ -20,7 +20,7 @@
{{- end }}
{{- end }}
{{- $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
{{- $disableImageOptimizationMD := .Page.Site.Params.disableImageOptimizationMD | default false }}
{{- $url := urls.Parse .Destination }}
{{- $altText := .Text }}
{{- $caption := .Title }}
@@ -36,7 +36,7 @@
{{ template "RenderImageSimple" (dict "src" $url.String "alt" $altText) }}
{{- else if $resource }}
{{- $isSVG := eq $resource.MediaType.SubType "svg" }}
{{- $shouldOptimize := and (not $disableImageOptimization) (not $isSVG) }}
{{- $shouldOptimize := and (not $disableImageOptimizationMD) (not $isSVG) }}
{{- if $shouldOptimize }}
{{ template "RenderImageResponsive" (dict "resource" $resource "alt" $altText) }}
{{- else }}