mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
Merge pull request #2166 from ZhenShuo2021/feat/image-option
✨ Feat: add new option disableImageOptimizationMD
This commit is contained in:
@@ -18,6 +18,7 @@ mainSections = ["docs"]
|
|||||||
# robots = ""
|
# robots = ""
|
||||||
|
|
||||||
disableImageOptimization = false
|
disableImageOptimization = false
|
||||||
|
disableImageOptimizationMD = false
|
||||||
disableTextInHeader = false
|
disableTextInHeader = false
|
||||||
# backgroundImageWidth = 1200
|
# backgroundImageWidth = 1200
|
||||||
|
|
||||||
|
|||||||
@@ -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. |
|
| `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. |
|
| `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. |
|
| `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 (``) |
|
||||||
|
| `disableImageOptimizationMD` | `false` | Disables image resize and optimization features only for images using markdown syntax (``). |
|
||||||
| `disableTextInHeader` | `false` | Disables text in header, useful for logo based headers. |
|
| `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 |
|
| `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. |
|
| `defaultFeaturedImage` | _Not set_ | Default background image for all `featured` images across articles, will be overridden by a local `featured` image. |
|
||||||
|
|||||||
@@ -177,7 +177,8 @@ Blowfish は、テーマの機能を制御する多数の設定パラメータ
|
|||||||
| `showLikes` | _未設定_ | 記事とリストのいいねを表示するかどうかです。これには Firebase 統合を有効にする必要があります。以下をご覧ください。 |
|
| `showLikes` | _未設定_ | 記事とリストのいいねを表示するかどうかです。これには Firebase 統合を有効にする必要があります。以下をご覧ください。 |
|
||||||
| `robots` | _未設定_ | ロボットがサイトをどのように処理するかを示す文字列です。設定されている場合、ページヘッダーに出力されます。有効な値については、[Google のドキュメント](https://developers.google.com/search/docs/advanced/robots/robots_meta_tag#directives)を参照してください。 |
|
| `robots` | _未設定_ | ロボットがサイトをどのように処理するかを示す文字列です。設定されている場合、ページヘッダーに出力されます。有効な値については、[Google のドキュメント](https://developers.google.com/search/docs/advanced/robots/robots_meta_tag#directives)を参照してください。 |
|
||||||
| `disableImageZoom` | `false` | サイト内のすべての画像の画像ズーム機能を無効にします。 |
|
| `disableImageZoom` | `false` | サイト内のすべての画像の画像ズーム機能を無効にします。 |
|
||||||
| `disableImageOptimization` | `false` | サイト内のすべての画像の画像サイズ変更と最適化機能を無効にします。 |
|
| `disableImageOptimization` | `false` | サイト内のすべての画像の画像サイズ変更と最適化機能を無効にします。Markdown 記法(例:``)の画像は対象外です。 |
|
||||||
|
| `disableImageOptimizationMD` | `false` | Markdown 記法(例:``)の画像の画像サイズ変更と最適化機能のみを無効にします。他の画像には適用されます。 |
|
||||||
| `disableTextInHeader` | `false` | ヘッダーのテキストを無効にします。ロゴベースのヘッダーに役立ちます。 |
|
| `disableTextInHeader` | `false` | ヘッダーのテキストを無効にします。ロゴベースのヘッダーに役立ちます。 |
|
||||||
| `defaultBackgroundImage` | _未設定_ | `background` ホームページレイアウトと `background` ヒーロースタイルの両方のデフォルトの背景画像です。 |
|
| `defaultBackgroundImage` | _未設定_ | `background` ホームページレイアウトと `background` ヒーロースタイルの両方のデフォルトの背景画像です。 |
|
||||||
| `defaultFeaturedImage` | _未設定_ | 記事全体のすべての `featured` 画像のデフォルトの背景画像です。ローカルの `featured` 画像によってオーバーライドされます。 |
|
| `defaultFeaturedImage` | _未設定_ | 記事全体のすべての `featured` 画像のデフォルトの背景画像です。ローカルの `featured` 画像によってオーバーライドされます。 |
|
||||||
|
|||||||
@@ -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. |
|
| `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. |
|
| `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. |
|
| `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 (``) |
|
||||||
|
| `disableImageOptimizationMD` | `false` | Disables image resize and optimization features only for images using markdown syntax (``). |
|
||||||
| `backgroundImageWidth` | `1200` | Width (in pixels) to scale background images to. |
|
| `backgroundImageWidth` | `1200` | Width (in pixels) to scale background images to. |
|
||||||
| `disableTextInHeader` | `false` | Disables text in header, useful for logo based headers. |
|
| `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 |
|
| `defaultBackgroundImage` | _Not set_ | Default background image for both `background` homepage layout and `background` hero style |
|
||||||
|
|||||||
@@ -180,7 +180,8 @@ Blowfish 提供了大量控制主题功能的配置参数,下面的表格中
|
|||||||
| `showLikes` | 无 | 是否显示文章和列表页面的点赞量。这需要集成 firebase ,具体可以看下面。 |
|
| `showLikes` | 无 | 是否显示文章和列表页面的点赞量。这需要集成 firebase ,具体可以看下面。 |
|
||||||
| `robots` | 无 | 用于支持搜索引擎爬虫如何处理你的网站。如果设置了该值,它将被输出在页面头部。具体的参数值请参考 [Google 文档](https://developers.google.com/search/docs/advanced/robots/robots_meta_tag#directives)。 |
|
| `robots` | 无 | 用于支持搜索引擎爬虫如何处理你的网站。如果设置了该值,它将被输出在页面头部。具体的参数值请参考 [Google 文档](https://developers.google.com/search/docs/advanced/robots/robots_meta_tag#directives)。 |
|
||||||
| `disableImageZoom` | `false` | 禁用网站上所有图片缩放功能。 |
|
| `disableImageZoom` | `false` | 禁用网站上所有图片缩放功能。 |
|
||||||
| `disableImageOptimization` | `false` | 禁用图片上所有图片的调整大小和优化功能。 |
|
| `disableImageOptimization` | `false` | 禁用图片上所有图片的调整大小和优化功能,使用 Markdown 语法插入的图片(``)除外。 |
|
||||||
|
| `disableImageOptimizationMD` | `false` | 所有以 Markdown 语法(``)插入的图片,禁用其调整大小和优化功能。 |
|
||||||
| `backgroundImageWidth` | `1200` | 宽度(以像素为单位)用于缩放背景图像。 |
|
| `backgroundImageWidth` | `1200` | 宽度(以像素为单位)用于缩放背景图像。 |
|
||||||
| `disableTextInHeader` | `false` | 禁用文本类型的标题,对基于 logo 的标题很有用。 |
|
| `disableTextInHeader` | `false` | 禁用文本类型的标题,对基于 logo 的标题很有用。 |
|
||||||
| `defaultBackgroundImage` | 无 | 设置默认背景图,用于 `background` 和 `hero` 布局下的主页。 |
|
| `defaultBackgroundImage` | 无 | 设置默认背景图,用于 `background` 和 `hero` 布局下的主页。 |
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }}
|
{{- $disableImageOptimizationMD := .Page.Site.Params.disableImageOptimizationMD | default false }}
|
||||||
{{- $url := urls.Parse .Destination }}
|
{{- $url := urls.Parse .Destination }}
|
||||||
{{- $altText := .Text }}
|
{{- $altText := .Text }}
|
||||||
{{- $caption := .Title }}
|
{{- $caption := .Title }}
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
{{ template "RenderImageSimple" (dict "src" $url.String "alt" $altText) }}
|
{{ template "RenderImageSimple" (dict "src" $url.String "alt" $altText) }}
|
||||||
{{- else if $resource }}
|
{{- else if $resource }}
|
||||||
{{- $isSVG := eq $resource.MediaType.SubType "svg" }}
|
{{- $isSVG := eq $resource.MediaType.SubType "svg" }}
|
||||||
{{- $shouldOptimize := and (not $disableImageOptimization) (not $isSVG) }}
|
{{- $shouldOptimize := and (not $disableImageOptimizationMD) (not $isSVG) }}
|
||||||
{{- if $shouldOptimize }}
|
{{- if $shouldOptimize }}
|
||||||
{{ template "RenderImageResponsive" (dict "resource" $resource "alt" $altText) }}
|
{{ template "RenderImageResponsive" (dict "resource" $resource "alt" $altText) }}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
|
|||||||
Reference in New Issue
Block a user