Skip to content

Commit

Permalink
feat: Support fediverse:creator OpenGraph tag (#465)
Browse files Browse the repository at this point in the history
  • Loading branch information
palant authored Sep 6, 2024
1 parent 77c0fc9 commit d523bcb
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,11 @@ See [#2](https://github.com/reuixiy/hugo-theme-meme/issues/2).
| motto | author’s description | string |
| avatar | author’s avatar | string, URL |
| twitter | author’s twitter id | string |
| fediverse | author’s fediverse id | string |
| disqus_url | \* | string, if not set, will use `Permalink` as default |
| disqus_identifier | \* | string, if not set, will use `RelPermalink` as default |
| disqus_title | \* | string, if not set, will use `Title` as default |

\*: see https://gohugo.io/content-management/front-matter/
\*: see https://gohugo.io/content-management/front-matter/
and https://gohugo.io/templates/internal/#configure-disqus
</details>
2 changes: 2 additions & 0 deletions config-examples/en/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1523,3 +1523,5 @@ uglyURLs = false
website = "https://io-oi.me/"
# Twitter
twitter = "reuixiy"
# Fediverse
fediverse = "@[email protected]"
2 changes: 2 additions & 0 deletions config-examples/zh-cn/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1488,3 +1488,5 @@ uglyURLs = false
website = "https://io-oi.me/"
# 推特
twitter = "reuixiy"
# Fediverse
fediverse = "@[email protected]"
2 changes: 2 additions & 0 deletions config-examples/zh-tw/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1488,3 +1488,5 @@ uglyURLs = false
website = "https://io-oi.me/"
# 推特
twitter = "reuixiy"
# Fediverse
fediverse = "@[email protected]"
6 changes: 6 additions & 0 deletions layouts/partials/utils/author.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
{{- with .Site.Params.author.twitter -}}
{{- $author = merge $author (dict "twitter" .) -}}
{{- end -}}
{{- with .Site.Params.author.fediverse -}}
{{- $author = merge $author (dict "fediverse" .) -}}
{{- end -}}
{{- else -}}
{{- with .Params.author -}}
{{- $author = merge $author (dict "name" .) -}}
Expand All @@ -44,5 +47,8 @@
{{- with .Params.twitter -}}
{{- $author = merge $author (dict "twitter" .) -}}
{{- end -}}
{{- with .Params.fediverse -}}
{{- $author = merge $author (dict "fediverse" .) -}}
{{- end -}}
{{- end -}}
{{- return $author -}}
5 changes: 5 additions & 0 deletions layouts/partials/utils/open-graph.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
{{- $description := .description -}}
<!-- Date -->
{{- $dates := partial "utils/date.html" $ -}}
<!-- Author -->
{{- $author := partial "utils/author.html" $ -}}
<!-- Images -->
{{- $images := partial "utils/images.html" $ -}}

Expand Down Expand Up @@ -42,3 +44,6 @@
{{ else -}}
<meta property="og:type" content="website" />
{{- end }}
{{- with $author.fediverse -}}
<meta name="fediverse:creator" content="{{ . }}" />
{{- end }}

0 comments on commit d523bcb

Please sign in to comment.