mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
feat: add BreadcrumbList (enableStructuredBreadcrumbs option)
also fix escape character in url of schema
This commit is contained in:
@@ -12,6 +12,7 @@ autoSwitchAppearance = true
|
|||||||
enableA11y = false
|
enableA11y = false
|
||||||
enableSearch = true
|
enableSearch = true
|
||||||
enableCodeCopy = false
|
enableCodeCopy = false
|
||||||
|
enableStructuredBreadcrumbs = false
|
||||||
|
|
||||||
replyByEmail = false
|
replyByEmail = false
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ autoSwitchAppearance = true
|
|||||||
enableA11y = false
|
enableA11y = false
|
||||||
enableSearch = true
|
enableSearch = true
|
||||||
enableCodeCopy = true
|
enableCodeCopy = true
|
||||||
|
enableStructuredBreadcrumbs = true
|
||||||
|
|
||||||
replyByEmail = false
|
replyByEmail = false
|
||||||
|
|
||||||
|
|||||||
@@ -174,6 +174,7 @@ Many of the article defaults here can be overridden on a per article basis by sp
|
|||||||
| `enableA11y` | `false` | Whether to enable the accessibility toggle button. |
|
| `enableA11y` | `false` | Whether to enable the accessibility toggle button. |
|
||||||
| `enableSearch` | `false` | Whether site search is enabled. Set to `true` to enable search functionality. Note that the search feature depends on the `outputs.home` setting in the [site configuration](#configurazioni-del-sito) being set correctly. |
|
| `enableSearch` | `false` | Whether site search is enabled. Set to `true` to enable search functionality. Note that the search feature depends on the `outputs.home` setting in the [site configuration](#configurazioni-del-sito) being set correctly. |
|
||||||
| `enableCodeCopy` | `false` | Whether copy-to-clipboard buttons are enabled for `<code>` blocks. The `highlight.noClasses` parameter must be set to `false` for code copy to function correctly. Read more about [other configuration files](#other-configuration-files) below. |
|
| `enableCodeCopy` | `false` | Whether copy-to-clipboard buttons are enabled for `<code>` blocks. The `highlight.noClasses` parameter must be set to `false` for code copy to function correctly. Read more about [other configuration files](#other-configuration-files) below. |
|
||||||
|
| `enableStructuredBreadcrumbs` | `false` | Whether to add [BreadcrumbList](https://developers.google.com/search/docs/appearance/structured-data/breadcrumb) for SEO. Do NOT enable this if your content path does not match the URL, i.e., complex [URL setting](https://gohugo.io/content-management/urls/). |
|
||||||
| `mainSections` | _Not set_ | The sections that should be displayed in the recent articles list. If not provided the section with the greatest number of articles is used. |
|
| `mainSections` | _Not set_ | The sections that should be displayed in the recent articles list. If not provided the section with the greatest number of articles is used. |
|
||||||
| `showViews` | _Not set_ | Whether or not articles and list views are displayed. This requires firebase integrations to be enabled, look below. |
|
| `showViews` | _Not set_ | Whether or not articles and list views 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. |
|
| `showLikes` | _Not set_ | Whether or not articles and list likes are displayed. This requires firebase integrations to be enabled, look below. |
|
||||||
|
|||||||
@@ -174,6 +174,7 @@ Blowfish は、テーマの機能を制御する多数の設定パラメータ
|
|||||||
| `enableA11y` | `false` | アクセシビリティ切り替えボタンを有効にするかどうか。 |
|
| `enableA11y` | `false` | アクセシビリティ切り替えボタンを有効にするかどうか。 |
|
||||||
| `enableSearch` | `false` | サイト内検索が有効かどうかです。`true` に設定すると、検索機能が有効になります。検索機能は、[サイト設定](#サイト設定)の `outputs.home` 設定が正しく設定されているかどうかに依存することに注意してください。 |
|
| `enableSearch` | `false` | サイト内検索が有効かどうかです。`true` に設定すると、検索機能が有効になります。検索機能は、[サイト設定](#サイト設定)の `outputs.home` 設定が正しく設定されているかどうかに依存することに注意してください。 |
|
||||||
| `enableCodeCopy` | `false` | `<code>` ブロックのクリップボードへのコピーボタンを有効にするかどうかです。コードコピーが正しく機能するには、`highlight.noClasses` パラメータを `false` に設定する必要があります。以下の[その他の設定ファイル](#その他の設定ファイル)について読んでください。 |
|
| `enableCodeCopy` | `false` | `<code>` ブロックのクリップボードへのコピーボタンを有効にするかどうかです。コードコピーが正しく機能するには、`highlight.noClasses` パラメータを `false` に設定する必要があります。以下の[その他の設定ファイル](#その他の設定ファイル)について読んでください。 |
|
||||||
|
| `enableStructuredBreadcrumbs` | `false` | SEO のために [BreadcrumbList](https://developers.google.com/search/docs/appearance/structured-data/breadcrumb) を追加するかどうかを示す。コンテンツパスが URL と一致しない場合例えば複雑な [URL 設定](https://gohugo.io/content-management/urls/) では有効化しないことを示す。 |
|
||||||
| `mainSections` | _未設定_ | 最近の記事リストに表示するセクションです。指定しない場合は、記事数が最も多いセクションが使用されます。 |
|
| `mainSections` | _未設定_ | 最近の記事リストに表示するセクションです。指定しない場合は、記事数が最も多いセクションが使用されます。 |
|
||||||
| `showViews` | _未設定_ | 記事とリストの表示回数を表示するかどうかです。これには Firebase 統合を有効にする必要があります。以下をご覧ください。 |
|
| `showViews` | _未設定_ | 記事とリストの表示回数を表示するかどうかです。これには Firebase 統合を有効にする必要があります。以下をご覧ください。 |
|
||||||
| `showLikes` | _未設定_ | 記事とリストのいいねを表示するかどうかです。これには Firebase 統合を有効にする必要があります。以下をご覧ください。 |
|
| `showLikes` | _未設定_ | 記事とリストのいいねを表示するかどうかです。これには Firebase 統合を有効にする必要があります。以下をご覧ください。 |
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ Many of the article defaults here can be overridden on a per article basis by sp
|
|||||||
| `enableA11y` | `false` | Whether to enable the accessibility toggle button. |
|
| `enableA11y` | `false` | Whether to enable the accessibility toggle button. |
|
||||||
| `enableSearch` | `false` | Whether site search is enabled. Set to `true` to enable search functionality. Note that the search feature depends on the `outputs.home` setting in the [site configuration](#site-configuration) being set correctly. |
|
| `enableSearch` | `false` | Whether site search is enabled. Set to `true` to enable search functionality. Note that the search feature depends on the `outputs.home` setting in the [site configuration](#site-configuration) being set correctly. |
|
||||||
| `enableCodeCopy` | `false` | Whether copy-to-clipboard buttons are enabled for `<code>` blocks. The `highlight.noClasses` parameter must be set to `false` for code copy to function correctly. Read more about [other configuration files](#other-configuration-files) below. |
|
| `enableCodeCopy` | `false` | Whether copy-to-clipboard buttons are enabled for `<code>` blocks. The `highlight.noClasses` parameter must be set to `false` for code copy to function correctly. Read more about [other configuration files](#other-configuration-files) below. |
|
||||||
|
| `enableStructuredBreadcrumbs` | `false` | Whether to add [BreadcrumbList](https://developers.google.com/search/docs/appearance/structured-data/breadcrumb) for SEO. Do NOT enable this if your content path does not match the URL, i.e., complex [URL setting](https://gohugo.io/content-management/urls/). |
|
||||||
| `replyByEmail` | `false` | Whether the reply-by-email link is enabled after post. The `params.author.email` parameter in `config/_default/languages.en.toml` must be set. |
|
| `replyByEmail` | `false` | Whether the reply-by-email link is enabled after post. The `params.author.email` parameter in `config/_default/languages.en.toml` must be set. |
|
||||||
| `forgejoDefaultServer` | _Not set_ | The default `server` parameter for the `forgejo` shortcode. |
|
| `forgejoDefaultServer` | _Not set_ | The default `server` parameter for the `forgejo` shortcode. |
|
||||||
| `giteaDefaultServer` | _Not set_ | The default `server` parameter for the `gitea` shortcode. |
|
| `giteaDefaultServer` | _Not set_ | The default `server` parameter for the `gitea` shortcode. |
|
||||||
|
|||||||
@@ -174,6 +174,7 @@ Blowfish 提供了大量控制主题功能的配置参数,下面的表格中
|
|||||||
| `enableA11y` | `false` | 是否启用无障碍切换按钮。 |
|
| `enableA11y` | `false` | 是否启用无障碍切换按钮。 |
|
||||||
| `enableSearch` | `false` | 是否开启网站的搜索功能,设为 `true` 即为启用。注意,搜索功能依赖于[站点设置](#网站配置)中的 `outputs.home` 设置,请确保此值配置正确。 |
|
| `enableSearch` | `false` | 是否开启网站的搜索功能,设为 `true` 即为启用。注意,搜索功能依赖于[站点设置](#网站配置)中的 `outputs.home` 设置,请确保此值配置正确。 |
|
||||||
| `enableCodeCopy` | `false` | 是否可以将`<code>`代码块复制到剪贴板。想要使用代码复制功能,需要将 `highlight.noClasses` 参数设置为 `false`。 阅读 [其他配置文件](#其他配置文件) 以获取更多信息。 |
|
| `enableCodeCopy` | `false` | 是否可以将`<code>`代码块复制到剪贴板。想要使用代码复制功能,需要将 `highlight.noClasses` 参数设置为 `false`。 阅读 [其他配置文件](#其他配置文件) 以获取更多信息。 |
|
||||||
|
| `enableStructuredBreadcrumbs` | `false` | 是否为 SEO 添加 [BreadcrumbList](https://developers.google.com/search/docs/appearance/structured-data/breadcrumb)。如果内容路径与 URL 不一致例如复杂的 [URL 设置](https://gohugo.io/content-management/urls/) 则不要启用。 |
|
||||||
| `replyByEmail` | `false` | 是否在发布后启用“通过邮件回复”的链接。如果使用,则必须设置 `config/_default/languages.en.toml` 中的 `params.author.email` 参数。 |
|
| `replyByEmail` | `false` | 是否在发布后启用“通过邮件回复”的链接。如果使用,则必须设置 `config/_default/languages.en.toml` 中的 `params.author.email` 参数。 |
|
||||||
| `forgejoDefaultServer` | _Not set_ | 短代码 `forgejo` 的默认 `server` 参数。 |
|
| `forgejoDefaultServer` | _Not set_ | 短代码 `forgejo` 的默认 `server` 参数。 |
|
||||||
| `giteaDefaultServer` | _Not set_ | 短代码 `gitea` 的默认 `server` 参数。 |
|
| `giteaDefaultServer` | _Not set_ | 短代码 `gitea` 的默认 `server` 参数。 |
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
{
|
{
|
||||||
"@context": "https://schema.org",
|
"@context": "https://schema.org",
|
||||||
"@type": "WebSite",
|
"@type": "WebSite",
|
||||||
"@id": "{{ (site.GetPage "/").Permalink | safeURL }}",
|
"@id": {{ site.Home.Permalink | safeURL }},
|
||||||
"name": "{{ .Site.Title | safeJS }}",
|
"name": "{{ .Site.Title | safeJS }}",
|
||||||
{{ with .Site.Params.description }}"description": "{{ . | safeJS }}",{{ end }}
|
{{ with .Site.Params.description }}"description": "{{ . | safeJS }}",{{ end }}
|
||||||
{{ with .Site.LanguageCode }}"inLanguage": "{{ . }}",{{ end }}
|
{{ with .Site.LanguageCode }}"inLanguage": "{{ . }}",{{ end }}
|
||||||
"url": "{{ (site.GetPage "/").Permalink | safeURL }}",
|
"url": {{ site.Home.Permalink | safeURL }},
|
||||||
{{ with .Site.Params.keywords }}"keywords": {{ . }},{{ end }}
|
{{ with .Site.Params.keywords }}"keywords": {{ . }},{{ end }}
|
||||||
"publisher" : {
|
"publisher" : {
|
||||||
"@type": "Person",
|
"@type": "Person",
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
{{ with .Description }}"description": "{{ . | safeJS }}",{{ end }}
|
{{ with .Description }}"description": "{{ . | safeJS }}",{{ end }}
|
||||||
{{ with .Summary }}"abstract": "{{ . | safeJS }}",{{ end }}
|
{{ with .Summary }}"abstract": "{{ . | safeJS }}",{{ end }}
|
||||||
{{ with .Site.LanguageCode }}"inLanguage": "{{ . }}",{{ end }}
|
{{ with .Site.LanguageCode }}"inLanguage": "{{ . }}",{{ end }}
|
||||||
"url" : "{{ .Permalink }}",
|
"url" : {{ .Permalink }},
|
||||||
"author" : {
|
"author" : {
|
||||||
"@type": "Person",
|
"@type": "Person",
|
||||||
"name": "{{ .Site.Params.Author.name | safeJS }}"
|
"name": "{{ .Site.Params.Author.name | safeJS }}"
|
||||||
@@ -44,6 +44,28 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
"mainEntityOfPage": "true",
|
"mainEntityOfPage": "true",
|
||||||
"wordCount": "{{ .WordCount }}"
|
"wordCount": "{{ .WordCount }}"
|
||||||
}]
|
}{{ if site.Params.enableStructuredBreadcrumbs | default false }},
|
||||||
|
{
|
||||||
|
"@context": "https://schema.org",
|
||||||
|
"@type": "BreadcrumbList",
|
||||||
|
"itemListElement": [
|
||||||
|
{{- $breadcrumbs := slice -}}
|
||||||
|
{{- range .Ancestors -}}
|
||||||
|
{{- if not .IsHome -}}
|
||||||
|
{{- $breadcrumbs = $breadcrumbs | append . -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- $breadcrumbs = $breadcrumbs | append . -}}
|
||||||
|
|
||||||
|
{{- range $index, $element := $breadcrumbs -}}
|
||||||
|
{
|
||||||
|
"@type": "ListItem",
|
||||||
|
"position": {{ add $index 1 }},
|
||||||
|
"name": "{{ .Title }}",
|
||||||
|
"item": {{ .Permalink }},
|
||||||
|
}{{ if ne (add $index 1) (len $breadcrumbs) }},{{ end }}
|
||||||
|
{{- end -}}
|
||||||
|
]
|
||||||
|
}{{ end }}]
|
||||||
</script>
|
</script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|||||||
Reference in New Issue
Block a user