Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
feat(avatar): added alt text
Browse files Browse the repository at this point in the history
fix #83
  • Loading branch information
victor-pogor committed Feb 15, 2021
1 parent f0fc9a2 commit dbd66ba
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
"mutantdino.resourcemonitor",
"budparr.language-hugo-vscode"
],
"runArgs": []
"runArgs": [],
"forwardPorts": [1313]
}
10 changes: 8 additions & 2 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ ignoreErrors = ["error-remote-getjson"]
gravatarEmail = ""
# URL of avatar shown in home page
avatarURL = "/images/avatar.png"
# {{< version 0.1.1 >}} Alt text for avatar (default is the author name)
avatarAlt = ""
# title shown in home page (HTML format is supported)
title = ""
# subtitle shown in home page
Expand Down Expand Up @@ -339,6 +341,8 @@ ignoreErrors = ["error-remote-getjson"]
gravatarEmail = ""
# 主页显示头像的 URL
avatarURL = "/images/avatar.png"
# {{< version 0.1.1 >}} Alt text for avatar (default is the author name)
avatarAlt = ""
# 主页显示的网站标题 (支持 HTML 格式)
title = ""
# 主页显示的网站副标题
Expand Down Expand Up @@ -535,6 +539,8 @@ ignoreErrors = ["error-remote-getjson"]
gravatarEmail = ""
# URL of avatar shown in home page
avatarURL = "/images/avatar.png"
# {{< version 0.1.1 >}} Alt text for avatar (default is the author name)
avatarAlt = ""
# title shown in home page (HTML format is supported)
title = ""
# subtitle shown in home page
Expand Down Expand Up @@ -903,7 +909,7 @@ ignoreErrors = ["error-remote-getjson"]
id = ""
# server url for your tracker if you're self hosting
server = ""
# Plausible Analytics
# {{< version 0.1.0 >}} Plausible Analytics
[params.analytics.plausible]
domain = ""

Expand Down Expand Up @@ -962,7 +968,7 @@ ignoreErrors = ["error-remote-getjson"]

# Author config
[author]
name = "xxxx"
name = "CodeIT"
email = ""
link = ""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ Please open the code block below to view the complete sample configuration :(far
gravatarEmail = ""
# URL of avatar shown in home page
avatarURL = "/images/avatar.png"
# {{< version 0.1.1 >}} Alt text for avatar (default is the author name)
avatarAlt = ""
# title shown in home page (HTML format is supported)
title = ""
# subtitle shown in home page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ Please open the code block below to view the complete sample configuration :(far
gravatarEmail = ""
# URL of avatar shown in home page
avatarURL = "/images/avatar.png"
# {{< version 0.1.1 >}} Alt text for avatar (default is the author name)
avatarAlt = ""
# title shown in home page (HTML format is supported)
title = ""
# subtitle shown in home page
Expand Down
5 changes: 3 additions & 2 deletions layouts/partials/home/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@
{{- if $avatar -}}
<div class="home-avatar">
{{- $menus := $.Site.Menus.main | default slice -}}
{{- $avatarAlt := $profile.avatarAlt | default .Site.Author.name -}}
{{- with index $menus 0 -}}
{{- $url := .URL | relLangURL -}}
{{- with .Page -}}
{{- $url = .RelPermalink -}}
{{- end -}}
<a href="{{ $url }}"{{ with .Title | default .Name }} title="{{ . }}"{{ end }}{{ if (urls.Parse $url).Host }} rel="noopener noreferrer" target="_blank"{{ end }}>
{{- dict "Src" $avatar | partial "plugin/image.html" -}}
{{- dict "Src" $avatar "Alt" $avatarAlt | partial "plugin/image.html" -}}
</a>
{{- else -}}
{{- dict "Src" $avatar | partial "plugin/image.html" -}}
{{- dict "Src" $avatar "Alt" $avatarAlt | partial "plugin/image.html" -}}
{{- end -}}
</div>
{{- end -}}
Expand Down

0 comments on commit dbd66ba

Please sign in to comment.