layouts: add support for setting additional relations on social links

This commit is contained in:
James Henstridge 2022-11-20 23:41:19 +08:00
parent b393088d09
commit 7b6006227f
3 changed files with 14 additions and 1 deletions

View File

@ -181,6 +181,18 @@ params:
On top of easily customizing the built-in services' label and color, user can overwrite their icon by adding an svg file at `/assets/ananke/socials` with a filename matching the service's name.
For example, in order to use your own GitHub icon, simply add an svg file at `/assets/ananke/socials/github.svg`
#### Additional relations
You can add extra relations to the social links via the `rel:` property. This can be used to assert ownership of the linked account as described in the [rel="me" mircroformat](https://microformats.org/wiki/rel-me).
```yaml
params:
ananke_socials:
- name: twitter
url: https://twitter.com/theNewDynamic
rel: me
```
#### Built-in Services
Here is the list of built-in services. Those marked with an `*` are also part of the "Share" module.

View File

@ -14,6 +14,7 @@
String (.label)
String (.color)?
Bool (.share)?
String (.rel)?
@uses
- partial

View File

@ -1,7 +1,7 @@
{{ $socials := where (partialCached "func/socials/Get" "socials/Get") "follow" "!=" false }}
<div class="ananke-socials">
{{ range $socials }}
<a href="{{ .url }}" target="_blank" class="{{ .name }} ananke-social-link link-transition stackoverflow link dib z-999 pt3 pt0-l {{ cond (eq $.Site.Language.LanguageDirection "rtl") "ml1" "mr1" }}" title="{{ .label }} link" rel="noopener" aria-label="follow on {{ .label }}——Opens in a new window">
<a href="{{ .url }}" target="_blank" class="{{ .name }} ananke-social-link link-transition stackoverflow link dib z-999 pt3 pt0-l {{ cond (eq $.Site.Language.LanguageDirection "rtl") "ml1" "mr1" }}" title="{{ .label }} link" rel="noopener{{ with .rel }} {{ . }}{{ end }}" aria-label="follow on {{ .label }}——Opens in a new window">
{{ with .icon }}
<span class="icon">{{ . }}</span>
{{ else }}