mirror of https://github.com/theNewDynamic/gohugo-theme-ananke.git

Regis Philibert
02.32.2022 a0c7382c597e817cb73c90684a32e14e74c33a28
Fix duplicate rel attributes on social-follow
2 files modified
7 ■■■■■ changed files
README.md 4 ●●●● patch | view | raw | blame | history
layouts/partials/social-follow.html 3 ●●●● patch | view | raw | blame | history
README.md
@@ -135,7 +135,7 @@
- name*: It matches the built-in service reference (Ex: twitter, github)
- url*: The url of the handle's profile on the service (Ex: https://twitter.com/theNewDynamic, https://github.com/
theNewDynamic)
- rel: Optional. Allows to add a `rel` attribute to the follow link. Useful for Mastodon verification which requires a `rel="me"` on the link.
- rel: (default: `noopener`) Controls the `rel` attribute of the "follow" link. Useful for Mastodon verification which requires a `rel="me"` on the link.
```yaml
params:
  ananke_socials:
@@ -145,7 +145,7 @@
    url: https://github.com/theNewDynamic
  - name: mastodon
    url: https://social.example.com/@username
    rel: me
    rel: me noopener
```
If user needs to overwrite default `color` and `label` of the service, they simply need to append the following to the entry:
layouts/partials/social-follow.html
@@ -1,7 +1,8 @@
{{ $socials := where (partialCached "func/socials/Get" "socials/Get") "follow" "!=" false }}
<div class="ananke-socials">
  {{ range $socials }}
    <a href="{{ .url }}" target="_blank" {{ with .rel }} rel="{{ . }}" {{ end }} 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">
    {{ $rel := .rel | default "noopener" }}
    <a href="{{ .url }}" target="_blank" rel="{{ $rel }}" 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" aria-label="follow on {{ .label }}——Opens in a new window">
      {{ with .icon }}
        <span class="icon">{{ . }}</span>
      {{ else }}