Skip to content

Commit

Permalink
1. Removed microdata and unified use of JSON-LD.
Browse files Browse the repository at this point in the history
2. Add alternateName field to webSite schema. That is an alternate site name
  used in Google search results.
3. Fix missing field in google rich result test.
4. Prioritize using the featured image in front matter as the article image in JSON-LD.
  • Loading branch information
wu0407 committed Dec 16, 2023
1 parent 2e6c4ab commit e515783
Show file tree
Hide file tree
Showing 6 changed files with 206 additions and 142 deletions.
4 changes: 4 additions & 0 deletions exampleSite/config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,10 @@ cacheRemoteImages = false
# thumbnail URL
# 缩略图 URL
thumbnailUrl = "/images/screenshot.png"
# Google 搜索结果中网站备用名字
# alternate site name in Google search result
# https://developers.google.com/search/docs/appearance/site-names#alternative
# alternateName = ["Hugo DoIt"]

# Analytics config
# 网站分析配置
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,9 @@ Please open the code block below to view the complete sample configuration :(far
image = ""
# thumbnail URL
thumbnailUrl = ""
# {{< version 0.4.1 >}}
# alternate site name in Google search result
alternateName = ["Hugo DoIt"]

# {{< version 0.2.0 >}} Analytics config
[params.analytics]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,9 @@ hugo
image = ""
# 缩略图 URL
thumbnailUrl = ""
# {{< version 0.4.1 >}}
# Google 搜索结果中网站备用名字
alternateName = ["Hugo DoIt"]

# {{< version 0.2.0 >}} 网站分析配置
[params.analytics]
Expand Down
4 changes: 2 additions & 2 deletions layouts/_default/summary.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- $params := .Params | merge .Site.Params.page -}}

<article class="single summary" itemscope itemtype="http://schema.org/Article">
<article class="single summary">
{{- /* Featured image */ -}}
{{- $image := $params.featuredImagePreview | default $params.featuredImage -}}
{{- $height := "auto" -}}
Expand Down Expand Up @@ -29,7 +29,7 @@
{{- end -}}

{{- /* Title */ -}}
<h1 class="single-title" itemprop="name headline">
<h1 class="single-title">
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</h1>

Expand Down
8 changes: 3 additions & 5 deletions layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,15 @@
{{- if ne .Site.Params.footer.copyright false -}}
<i class="far fa-copyright fa-fw"></i>
{{- with .Site.Params.footer.since -}}
<span itemprop="copyrightYear">
{{- if lt . now.Year }}{{ . }} - {{ end }}{{ now.Year -}}
</span>
{{- if lt . now.Year }}{{ . }} - {{ end }}{{ now.Year -}}
{{- else -}}
<span itemprop="copyrightYear">{{ now.Year }}</span>
{{ now.Year }}
{{- end -}}
{{- end -}}

{{- /* Author */ -}}
{{- if ne .Site.Params.footer.author false -}}
<span class="author" itemprop="copyrightHolder">&nbsp;<a href="{{ $.Site.Author.link | default .Site.Home.RelPermalink }}" target="_blank" rel="noopener noreferrer">{{ .Site.Author.name }}</a></span>
<span class="author">&nbsp;<a href="{{ $.Site.Author.link | default .Site.Home.RelPermalink }}" target="_blank" rel="noopener noreferrer">{{ .Site.Author.name }}</a></span>
{{- end -}}

{{- /* License */ -}}
Expand Down
Loading

0 comments on commit e515783

Please sign in to comment.