diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 9a387308..01e34cc5 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1 @@ -custom: https://www.paypal.me/dillonzq +custom: https://paypal.me/dillonzq diff --git a/exampleSite/content/about/Apple-Devices-Preview.png b/exampleSite/assets/images/Apple-Devices-Preview.png similarity index 100% rename from exampleSite/content/about/Apple-Devices-Preview.png rename to exampleSite/assets/images/Apple-Devices-Preview.png diff --git a/exampleSite/static/images/Wavelength.jpg b/exampleSite/assets/images/Wavelength.jpg similarity index 100% rename from exampleSite/static/images/Wavelength.jpg rename to exampleSite/assets/images/Wavelength.jpg diff --git a/exampleSite/static/images/avatar.png b/exampleSite/assets/images/avatar.png similarity index 100% rename from exampleSite/static/images/avatar.png rename to exampleSite/assets/images/avatar.png diff --git a/exampleSite/static/images/lighthouse-large.jpg b/exampleSite/assets/images/lighthouse-large.jpg similarity index 100% rename from exampleSite/static/images/lighthouse-large.jpg rename to exampleSite/assets/images/lighthouse-large.jpg diff --git a/exampleSite/static/images/lighthouse-small.jpg b/exampleSite/assets/images/lighthouse-small.jpg similarity index 100% rename from exampleSite/static/images/lighthouse-small.jpg rename to exampleSite/assets/images/lighthouse-small.jpg diff --git a/exampleSite/static/images/lighthouse.jpg b/exampleSite/assets/images/lighthouse.jpg similarity index 100% rename from exampleSite/static/images/lighthouse.jpg rename to exampleSite/assets/images/lighthouse.jpg diff --git a/exampleSite/assets/images/screenshot.png b/exampleSite/assets/images/screenshot.png new file mode 100644 index 00000000..3fb6515f Binary files /dev/null and b/exampleSite/assets/images/screenshot.png differ diff --git a/exampleSite/static/music/Wavelength.mp3 b/exampleSite/assets/music/Wavelength.mp3 similarity index 100% rename from exampleSite/static/music/Wavelength.mp3 rename to exampleSite/assets/music/Wavelength.mp3 diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 6f7dda96..a7b14a62 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -936,29 +936,17 @@ enableEmoji = true # located in "assets/" 位于 "assets/" # Or 或者 # someJavascript = "https://cdn.example.com/some.js" - # SEO config - # SEO 配置 + # Page SEO config + # 页面 SEO 配置 [params.page.seo] + # image URL + # 图片 URL + images = [] # Publisher info # 出版者信息 [params.page.seo.publisher] name = "xxxx" - [params.page.seo.publisher.logo] - url = "logo.png" - width = 127 - height = 40 - # Logo info - # Logo 信息 - [params.page.seo.logo] - url = "logo.png" - width = 127 - height = 40 - # Image info - # 图片信息 - [params.page.seo.image] - url = "cover.png" - width = 800 - height = 600 + logoUrl = "/images/avatar.png" # TypeIt config # TypeIt 配置 @@ -985,6 +973,16 @@ enableEmoji = true pinterest = "" baidu = "" + # Site SEO config + # 网站 SEO 配置 + [params.seo] + # image URL + # 图片 URL + image = "/images/Apple-Devices-Preview.png" + # thumbnail URL + # 缩略图 URL + thumbnailUrl = "/images/screenshot.png" + # Analytics config # 网站分析配置 [params.analytics] diff --git a/exampleSite/content/about/index.en.md b/exampleSite/content/about/index.en.md index 25056e6e..6d4b15fc 100644 --- a/exampleSite/content/about/index.en.md +++ b/exampleSite/content/about/index.en.md @@ -21,7 +21,7 @@ math: > > It is based on the original [LeaveIt Theme](https://github.com/liuzc/LeaveIt) and [KeepIt Theme](https://github.com/Fastbyte01/KeepIt). -![Hugo Theme LoveIt](Apple-Devices-Preview.png "Hugo Theme LoveIt") +![Hugo Theme LoveIt](/images/Apple-Devices-Preview.png "Hugo Theme LoveIt") ### Features diff --git a/exampleSite/content/about/index.fr.md b/exampleSite/content/about/index.fr.md index e512274f..58013fea 100644 --- a/exampleSite/content/about/index.fr.md +++ b/exampleSite/content/about/index.fr.md @@ -26,7 +26,7 @@ Welcome to take the time to propose a translation by [:(fas fa-code-branch fa-fw > > It is based on the original [LeaveIt Theme](https://github.com/liuzc/LeaveIt) and [KeepIt Theme](https://github.com/Fastbyte01/KeepIt). -![Hugo Theme LoveIt](Apple-Devices-Preview.png "Hugo Theme LoveIt") +![Hugo Theme LoveIt](/images/Apple-Devices-Preview.png "Hugo Theme LoveIt") ### Features diff --git a/exampleSite/content/about/index.zh-cn.md b/exampleSite/content/about/index.zh-cn.md index 9cbe6040..6a830a6b 100644 --- a/exampleSite/content/about/index.zh-cn.md +++ b/exampleSite/content/about/index.zh-cn.md @@ -21,7 +21,7 @@ math: > > 它的原型基于 [LeaveIt 主题](https://github.com/liuzc/LeaveIt) 和 [KeepIt 主题](https://github.com/Fastbyte01/KeepIt)。 -![Hugo 主题 LoveIt](Apple-Devices-Preview.png "Hugo 主题 LoveIt") +![Hugo 主题 LoveIt](/images/Apple-Devices-Preview.png "Hugo 主题 LoveIt") ### 特性 diff --git a/exampleSite/content/posts/theme-documentation-basics/index.en.md b/exampleSite/content/posts/theme-documentation-basics/index.en.md index 6db97742..5a0cd13f 100644 --- a/exampleSite/content/posts/theme-documentation-basics/index.en.md +++ b/exampleSite/content/posts/theme-documentation-basics/index.en.md @@ -573,25 +573,14 @@ Please open the code block below to view the complete sample configuration :(far # located in "assets/" # Or # someJavascript = "https://cdn.example.com/some.js" - # {{< version 0.2.0 >}} SEO config + # {{< version 0.2.10 changed >}} Page SEO config [params.page.seo] + # image URL + images = [] # Publisher info [params.page.seo.publisher] - name = "xxxx" - [params.page.seo.publisher.logo] - url = "logo.png" - width = 127 - height = 40 - # Logo info - [params.page.seo.logo] - url = "logo.png" - width = 127 - height = 40 - # Image info - [params.page.seo.image] - url = "cover.png" - width = 800 - height = 600 + name = "" + logoUrl = "" # {{< version 0.2.5 >}} TypeIt config [params.typeit] @@ -612,6 +601,13 @@ Please open the code block below to view the complete sample configuration :(far pinterest = "" baidu = "" + # {{< version 0.2.10 >}} Site SEO config + [params.seo] + # image URL + image = "" + # thumbnail URL + thumbnailUrl = "" + # {{< version 0.2.0 >}} Analytics config [params.analytics] enable = false @@ -803,11 +799,7 @@ into `/static`. They’re easily created via [https://realfavicongenerator.net/] Customize `browserconfig.xml` and `site.webmanifest` to set theme-color and background-color. -### 3.3 Add Logo and Cover for SEO - -Add a logo image (127x40) and a cover image (800x600) in the `static` directory. - -### 3.4 Style Customization +### 3.3 Style Customization {{< version 0.2.8 changed >}} diff --git a/exampleSite/content/posts/theme-documentation-basics/index.fr.md b/exampleSite/content/posts/theme-documentation-basics/index.fr.md index 17399361..9ec51071 100644 --- a/exampleSite/content/posts/theme-documentation-basics/index.fr.md +++ b/exampleSite/content/posts/theme-documentation-basics/index.fr.md @@ -578,25 +578,14 @@ Please open the code block below to view the complete sample configuration :(far # located in "assets/" # Or # someJavascript = "https://cdn.example.com/some.js" - # {{< version 0.2.0 >}} SEO config + # {{< version 0.2.10 changed >}} Page SEO config [params.page.seo] + # image URL + images = [] # Publisher info [params.page.seo.publisher] - name = "xxxx" - [params.page.seo.publisher.logo] - url = "logo.png" - width = 127 - height = 40 - # Logo info - [params.page.seo.logo] - url = "logo.png" - width = 127 - height = 40 - # Image info - [params.page.seo.image] - url = "cover.png" - width = 800 - height = 600 + name = "" + logoUrl = "" # {{< version 0.2.5 >}} TypeIt config [params.typeit] @@ -617,6 +606,13 @@ Please open the code block below to view the complete sample configuration :(far pinterest = "" baidu = "" + # {{< version 0.2.10 >}} Site SEO config + [params.seo] + # image URL + image = "" + # thumbnail URL + thumbnailUrl = "" + # {{< version 0.2.0 >}} Analytics config [params.analytics] enable = false @@ -808,11 +804,7 @@ into `/static`. They’re easily created via [https://realfavicongenerator.net/] Customize `browserconfig.xml` and `site.webmanifest` to set theme-color and background-color. -### 3.3 Add Logo and Cover for SEO - -Add a logo image (127x40) and a cover image (800x600) in the `static` directory. - -### 3.4 Style Customization +### 3.3 Style Customization {{< version 0.2.8 changed >}} diff --git a/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md b/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md index 225c672f..884e367d 100644 --- a/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md +++ b/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md @@ -576,25 +576,14 @@ hugo # 位于 "assets/" # 或者 # someJavascript = "https://cdn.example.com/some.js" - # {{< version 0.2.0 >}} SEO config + # {{< version 0.2.10 changed >}} 页面 SEO 配置 [params.page.seo] + # 图片 URL + images = [] # 出版者信息 [params.page.seo.publisher] - name = "xxxx" - [params.page.seo.publisher.logo] - url = "logo.png" - width = 127 - height = 40 - # Logo 信息 - [params.page.seo.logo] - url = "logo.png" - width = 127 - height = 40 - # 图片信息 - [params.page.seo.image] - url = "cover.png" - width = 800 - height = 600 + name = "" + logoUrl = "" # {{< version 0.2.5 >}} TypeIt 配置 [params.typeit] @@ -615,6 +604,13 @@ hugo pinterest = "" baidu = "" + # {{< version 0.2.10 >}} 网站 SEO 配置 + [params.seo] + # 图片 URL + image = "" + # 缩略图 URL + thumbnailUrl = "" + # {{< version 0.2.0 >}} 网站分析配置 [params.analytics] enable = false @@ -807,11 +803,7 @@ hugo 可以自定义 `browserconfig.xml` 和 `site.webmanifest` 文件来设置 theme-color 和 background-color. -### 3.3 增加网站 logo 和封面用于 SEO 优化 - -在 `static` 目录增加一个 logo 图片 (127x40) 和一个封面图片 (800x600). - -### 3.4 自定义样式 +### 3.3 自定义样式 {{< version 0.2.8 changed >}} diff --git a/exampleSite/content/posts/theme-documentation-content/index.en.md b/exampleSite/content/posts/theme-documentation-content/index.en.md index e2a1f111..dbd5a575 100644 --- a/exampleSite/content/posts/theme-documentation-content/index.en.md +++ b/exampleSite/content/posts/theme-documentation-content/index.en.md @@ -124,6 +124,9 @@ library: # located in "assets/" # Or # someJS = "https://cdn.example.com/some.js" +seo: + images: [] + # ... --- ``` @@ -160,6 +163,7 @@ library: * **share**: the same as the `params.page.share` part in the [site configuration](../theme-documentation-basics#site-configuration). * **comment**: {{< version 0.2.0 changed >}} the same as the `params.page.comment` part in the [site configuration](../theme-documentation-basics#site-configuration). * **library**: {{< version 0.2.7 >}} the same as the `params.page.library` part in the [site configuration](../theme-documentation-basics#site-configuration). +* **seo**: {{< version 0.2.10 >}} the same as the `params.page.seo` part in the [site configuration](../theme-documentation-basics#site-configuration). {{< admonition tip >}} {{< version 0.2.10 >}} diff --git a/exampleSite/content/posts/theme-documentation-content/index.fr.md b/exampleSite/content/posts/theme-documentation-content/index.fr.md index 97038616..9fdedd3d 100644 --- a/exampleSite/content/posts/theme-documentation-content/index.fr.md +++ b/exampleSite/content/posts/theme-documentation-content/index.fr.md @@ -129,6 +129,9 @@ library: # located in "assets/" # Or # someJS = "https://cdn.example.com/some.js" +seo: + images: [] + # ... --- ``` @@ -165,6 +168,7 @@ library: * **share**: the same as the `params.page.share` part in the [site configuration](../theme-documentation-basics#site-configuration). * **comment**: {{< version 0.2.0 changed >}} the same as the `params.page.comment` part in the [site configuration](../theme-documentation-basics#site-configuration). * **library**: {{< version 0.2.7 >}} the same as the `params.page.library` part in the [site configuration](../theme-documentation-basics#site-configuration). +* **seo**: {{< version 0.2.10 >}} the same as the `params.page.seo` part in the [site configuration](../theme-documentation-basics#site-configuration). {{< admonition tip >}} {{< version 0.2.10 >}} diff --git a/exampleSite/content/posts/theme-documentation-content/index.zh-cn.md b/exampleSite/content/posts/theme-documentation-content/index.zh-cn.md index 2f4b997f..15b09262 100644 --- a/exampleSite/content/posts/theme-documentation-content/index.zh-cn.md +++ b/exampleSite/content/posts/theme-documentation-content/index.zh-cn.md @@ -123,6 +123,9 @@ library: # 位于 "assets/" # 或者 # someJS = "https://cdn.example.com/some.js" +seo: + images: [] + # ... --- ``` @@ -159,6 +162,7 @@ library: * **share**: 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.share` 部分相同. * **comment**: {{< version 0.2.0 changed >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.comment` 部分相同. * **library**: {{< version 0.2.7 >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.library` 部分相同. +* **seo**: {{< version 0.2.10 >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.seo` 部分相同. {{< admonition tip >}} {{< version 0.2.10 >}} diff --git a/exampleSite/static/logo.png b/exampleSite/static/logo.png deleted file mode 100644 index f8d370d7..00000000 Binary files a/exampleSite/static/logo.png and /dev/null differ diff --git a/layouts/partials/head/seo.html b/layouts/partials/head/seo.html index 214958ad..d431ad06 100644 --- a/layouts/partials/head/seo.html +++ b/layouts/partials/head/seo.html @@ -35,11 +35,25 @@ {{- with .Site.Params.description -}} "description": {{ . | safeHTML }}, {{- end -}} - {{- with $params.seo.image -}} - "image": "{{ .url | absURL }}", + {{- $image := .Site.Params.seo.image -}} + {{- with dict "Path" $image "Resources" .Resources | partial "function/resource.html" -}} + "image": { + "@type": "ImageObject", + "url": "{{ .Permalink }}", + "width": {{ .Width }}, + "height": {{ .Height }} + }, + {{- else -}} + {{- with $image -}} + "image": "{{ . | absURL }}", + {{- end -}} {{- end -}} - {{- with $params.seo.logo -}} - "thumbnailUrl": "{{ .url | absURL }}", + {{- with .Site.Params.seo.thumbnailUrl -}} + {{- with dict "Path" . "Resources" $.Resources | partial "function/resource.html" -}} + "thumbnailUrl": "{{ .Permalink }}", + {{- else -}} + "thumbnailUrl": "{{ . | absURL }}", + {{- end -}} {{- end -}} {{- with .Site.Copyright -}} "license": "{{ . | safeHTML }}", @@ -60,13 +74,36 @@ "@type": "WebPage", "@id": "{{ .Permalink }}" }, - {{- if ge $params.seo.image.width 696 -}} - "image": { - "@type": "ImageObject", - "url": "{{ $params.seo.image.url | absURL }}", - "width": {{ $params.seo.image.width }}, - "height": {{ $params.seo.image.height }} - }, + {{- $images := $params.seo.images | default slice -}} + {{- if not $images -}} + {{- with .Resources.GetMatch "featured-image-preview" -}} + {{- $images = slice "featured-image-preview" -}} + {{- end -}} + {{- with .Resources.GetMatch "featured-image" -}} + {{- $images = slice "featured-image" -}} + {{- end -}} + {{- end -}} + {{- with .Site.Params.seo.image -}} + {{- $images = $images | default (slice .) -}} + {{- end -}} + {{- with $images -}} + "image": [ + {{- range $index, $value := . -}} + {{- if gt $index 0 }},{{ end -}} + {{- with dict "Path" $value "Resources" $.Resources | partial "function/resource.html" -}} + { + "@type": "ImageObject", + "url": "{{ .Permalink }}", + "width": {{ .Width }}, + "height": {{ .Height }} + } + {{- else -}} + {{- with $value -}} + "{{ . | absURL }}" + {{- end -}} + {{- end -}} + {{- end -}} + ], {{- end -}} "genre": "{{ .Type }}", {{- with .Params.tags -}} @@ -85,18 +122,25 @@ {{- with .Site.Copyright -}} "license": {{ . | safeHTML }}, {{- end -}} - {{- with $params.seo.publisher -}} - "publisher": { - "@type": "Organization", - "name": {{ .name | safeHTML }}, - "logo": { - "@type": "ImageObject", - "url": "{{ .logo.url | absURL }}", - "width": {{ .logo.width }}, - "height": {{ .logo.height }} + {{- $publisher := .Params.author | default .Site.Author.name | default (T "author") | dict "name" -}} + {{- $publisher = $params.seo.publisher | default dict | merge $publisher -}} + "publisher": { + "@type": "Organization", + "name": {{ $publisher.name | safeHTML }} + {{- $logo := $publisher.logoUrl -}} + {{- with dict "Path" $logo "Resources" .Resources | partial "function/resource.html" -}} + ,"logo": { + "@type": "ImageObject", + "url": "{{ .Permalink }}", + "width": {{ .Width }}, + "height": {{ .Height }} } - }, - {{- end -}} + {{- else -}} + {{- with $logo -}} + ,"logo": "{{ . | absURL }}" + {{- end -}} + {{- end -}} + }, {{- with .Params.author | default .Site.Author.name | default (T "author") -}} "author": { "@type": "Person",