Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions assets/css/_page/_single.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@
display: inline-block;
}

.post-author {
.h-card img {
max-height: 1.5em;
width: auto;
margin-right: .25rem;
border-radius: 50%;
vertical-align: middle;
}
}

[theme=dark] & {
color: $global-font-secondary-color-dark;
}
Expand Down
10 changes: 10 additions & 0 deletions exampleSite/hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"]
name = "xxxx"
email = ""
link = ""
# URL of the author avatar (photo)
# 作者头像(照片)的 URL
avatar = "/images/avatar.png"

# Header config
# 页面头部导航栏配置
Expand Down Expand Up @@ -217,6 +220,13 @@ ignoreErrors = ["error-remote-getjson", "error-missing-instagram-accesstoken"]
# Windows v8-11 磁贴颜色
tileColor = "#da532c"

# Security config
# 安全配置
[params.security]
# Content-Security-Policy meta tag for when HTTP headers cannot be set
# https://content-security-policy.com/examples/meta/
# contentSecurityPolicy = "default-src 'self'"

# Search config
# 搜索配置
[params.search]
Expand Down
11 changes: 11 additions & 0 deletions hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
name = "xxxx"
email = ""
link = ""
# URL of the author avatar (photo)
# 作者头像(照片)的 URL
avatar = ""

# Header config
# 页面头部导航栏配置
Expand Down Expand Up @@ -136,6 +139,14 @@
# Windows v8-11 磁贴颜色
tileColor = "#da532c"

# Security config
# 安全配置
[params.security]
# Content-Security-Policy meta tag for when HTTP headers cannot be set
# https://content-security-policy.com/examples/meta/
# 当无法设置 HTTP 响应头时使用的 Content-Security-Policy meta 标签
# contentSecurityPolicy = "default-src 'self'"

# Search config
# 搜索配置
[params.search]
Expand Down
5 changes: 5 additions & 0 deletions layouts/_partials/head/meta.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@
{{- with .Site.Params.app.tileColor -}}
<meta name="msapplication-TileColor" content="{{ . }}">
{{- end -}}

{{- /* Content-Security-Policy meta tag (when HTTP headers cannot be set) - see https://content-security-policy.com/examples/meta/ */ -}}
{{- with .Site.Params.security.contentSecurityPolicy -}}
<meta http-equiv="Content-Security-Policy" content="{{ . }}">
{{- end -}}
16 changes: 15 additions & 1 deletion layouts/_partials/head/seo.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,24 @@
{{- end -}}
{{- end -}}
},
{{- with .Params.author | default .Site.Params.Author.name | default (T "author") -}}
{{- $authorName := .Params.author | default .Site.Params.Author.name | default (T "author") -}}
{{- with $authorName -}}
"author": {
"@type": "Person",
"name": {{ . | safeHTML }}
{{- $authorAvatar := $.Params.authorAvatar | default $.Site.Params.Author.avatar -}}
{{- with dict "Path" $authorAvatar "Resources" $.Resources | partial "function/resource.html" -}}
,"image": {
"@type": "ImageObject",
"url": "{{ .Permalink }}",
"width": {{ .Width }},
"height": {{ .Height }}
}
{{- else -}}
{{- with $authorAvatar -}}
,"image": "{{ . | absURL }}"
{{- end -}}
{{- end -}}
},
{{- end -}}
"description": {{ .Description | safeHTML }}
Expand Down
5 changes: 3 additions & 2 deletions layouts/posts/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ <h2 class="single-subtitle">{{ . }}</h2>
<div class="post-meta-line">
{{- $author := $params.author | default .Site.Params.Author.name | default (T "author") -}}
{{- $authorLink := $params.authorlink | default .Site.Params.Author.link | default .Site.Home.RelPermalink -}}
{{- $authorAvatar := .Params.authorAvatar | default .Site.Params.Author.avatar -}}
<span class="post-author">
{{- $options := dict "Class" "author" "Destination" $authorLink "Title" "Author" "Rel" "author" "Icon" (dict "Class" "fas fa-user-circle") "Content" $author -}}
{{- partial "plugin/a.html" $options -}}
{{- $options := dict "Class" "person-mention author" "Name" $author "URL" $authorLink "Rel" "author" "Image" $authorAvatar -}}
{{- partial "plugin/h-card" $options -}}
</span>

{{- $categories := slice -}}
Expand Down
5 changes: 3 additions & 2 deletions layouts/summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ <h1 class="single-title" itemprop="name headline">
<div class="post-meta">
{{- $author := $params.author | default .Site.Params.Author.name | default (T "author") -}}
{{- $authorLink := $params.authorlink | default .Site.Params.Author.link | default .Site.Home.RelPermalink -}}
{{- $authorAvatar := .Params.authorAvatar | default .Site.Params.Author.avatar -}}
<span class="post-author">
{{- $options := dict "Class" "author" "Destination" $authorLink "Title" "Author" "Rel" "author" "Icon" (dict "Class" "fas fa-user-circle") "Content" $author -}}
{{- partial "plugin/a.html" $options -}}
{{- $options := dict "Class" "person-mention author" "Name" $author "URL" $authorLink "Rel" "author" "Image" $authorAvatar -}}
{{- partial "plugin/h-card" $options -}}
</span>

{{- with .Site.Params.dateFormat | default "2006-01-02" | .PublishDate.Format -}}
Expand Down
Loading