Skip to content

Commit

Permalink
feat: add rel="me" to Mastodon sidebar contact links for verificati…
Browse files Browse the repository at this point in the history
…on (#807)

This will enable verification with Mastodon by including the `rel="me"` attribute.
https://docs.joinmastodon.org/user/profile/#verification

Co-authored-by: Cotes Chung <11371340+cotes2020@users.noreply.github.com>
  • Loading branch information
kendaleiv and cotes2020 committed Dec 24, 2022
1 parent 8e73a91 commit d2190c7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion _data/contact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# -
# type: mastodon
# icon: 'fab fa-mastodon' # icons powered by <https://fontawesome.com/>
# url: '' # Fill with your mastodon account page
# url: '' # Fill with your Mastodon account page, rel="me" will be applied for verification
# -
# type: linkedin
# icon: 'fab fa-linkedin' # icons powered by <https://fontawesome.com/>
Expand Down
12 changes: 11 additions & 1 deletion _includes/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,17 @@

{% if url %}
<a href="{{ url }}" aria-label="{{ entry.type }}"
{% unless entry.noblank %}target="_blank" rel="noopener"{% endunless %}>
{% assign link_types = nil %}
{% unless entry.noblank %}
{% assign link_types = link_types | append: " noopener" %}
target="_blank"
{% endunless %}

{% if entry.type == 'mastodon' %}
{% assign link_types = link_types | append: " me" %}
{% endif %}

{% if link_types %}rel="{{ link_types | lstrip }}"{% endif %}>
<i class="{{ entry.icon }}"></i>
</a>
{% endif %}
Expand Down

0 comments on commit d2190c7

Please sign in to comment.