feat(SEO): update SEO config (#393)
2
.github/FUNDING.yml
vendored
|
@ -1 +1 @@
|
|||
custom: https://www.paypal.me/dillonzq
|
||||
custom: https://paypal.me/dillonzq
|
||||
|
|
Before Width: | Height: | Size: 222 KiB After Width: | Height: | Size: 222 KiB |
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 97 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 1.6 MiB After Width: | Height: | Size: 1.6 MiB |
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 107 KiB |
Before Width: | Height: | Size: 638 KiB After Width: | Height: | Size: 638 KiB |
BIN
exampleSite/assets/images/screenshot.png
Normal file
After Width: | Height: | Size: 71 KiB |
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
||||
### 特性
|
||||
|
||||
|
|
|
@ -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 >}}
|
||||
|
||||
|
|
|
@ -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 >}}
|
||||
|
||||
|
|
|
@ -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 >}}
|
||||
|
||||
|
|
|
@ -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 >}}
|
||||
|
|
|
@ -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 >}}
|
||||
|
|
|
@ -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 >}}
|
||||
|
|
Before Width: | Height: | Size: 40 KiB |
|
@ -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 .Site.Params.seo.thumbnailUrl -}}
|
||||
{{- with dict "Path" . "Resources" $.Resources | partial "function/resource.html" -}}
|
||||
"thumbnailUrl": "{{ .Permalink }}",
|
||||
{{- else -}}
|
||||
"thumbnailUrl": "{{ . | absURL }}",
|
||||
{{- end -}}
|
||||
{{- with $params.seo.logo -}}
|
||||
"thumbnailUrl": "{{ .url | absURL }}",
|
||||
{{- end -}}
|
||||
{{- with .Site.Copyright -}}
|
||||
"license": "{{ . | safeHTML }}",
|
||||
|
@ -60,13 +74,36 @@
|
|||
"@type": "WebPage",
|
||||
"@id": "{{ .Permalink }}"
|
||||
},
|
||||
{{- if ge $params.seo.image.width 696 -}}
|
||||
"image": {
|
||||
{{- $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": "{{ $params.seo.image.url | absURL }}",
|
||||
"width": {{ $params.seo.image.width }},
|
||||
"height": {{ $params.seo.image.height }}
|
||||
},
|
||||
"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 := .Params.author | default .Site.Author.name | default (T "author") | dict "name" -}}
|
||||
{{- $publisher = $params.seo.publisher | default dict | merge $publisher -}}
|
||||
"publisher": {
|
||||
"@type": "Organization",
|
||||
"name": {{ .name | safeHTML }},
|
||||
"logo": {
|
||||
"name": {{ $publisher.name | safeHTML }}
|
||||
{{- $logo := $publisher.logoUrl -}}
|
||||
{{- with dict "Path" $logo "Resources" .Resources | partial "function/resource.html" -}}
|
||||
,"logo": {
|
||||
"@type": "ImageObject",
|
||||
"url": "{{ .logo.url | absURL }}",
|
||||
"width": {{ .logo.width }},
|
||||
"height": {{ .logo.height }}
|
||||
"url": "{{ .Permalink }}",
|
||||
"width": {{ .Width }},
|
||||
"height": {{ .Height }}
|
||||
}
|
||||
},
|
||||
{{- else -}}
|
||||
{{- with $logo -}}
|
||||
,"logo": "{{ . | absURL }}"
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
},
|
||||
{{- with .Params.author | default .Site.Author.name | default (T "author") -}}
|
||||
"author": {
|
||||
"@type": "Person",
|
||||
|
|