Skip to content

Commit

Permalink
Add Mastodon handle support to author profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
zeppelin committed Dec 9, 2024
1 parent 5fce0cb commit ae1bf3f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ module.exports = function (eleventyConfig) {
return response.data.replace("<svg", `<svg focusable="false" role="presentation"`);
});

eleventyConfig.addShortcode("mastodonHandleUrl", handle => {
const [user, server] = handle.split("@").filter(Boolean);
return `https://${server}/@${user}`;
});

eleventyConfig.setServerOptions({
watch: ["./dist/assets/css/*.css", "./dist/assets/js/*.js"],
});
Expand Down
2 changes: 1 addition & 1 deletion src/authors/zeppelin.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: "Gabor Babicz"
github: zeppelin
twitter: xeppelin
mastodon: "@[email protected]"
linkedin: xeppelin
bio: "Senior Software Engineer"
---
11 changes: 11 additions & 0 deletions src/components/author-socials.njk
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@
</a>
</li>
{% endif %}
{% if author.data.mastodon %}
<li>
<a
class="author-socials__icon"
href="{% mastodonHandleUrl author.data.mastodon %}"
>
{% include 'svg/social-mastodon.njk' %}
<span class="screenreader">{{ author.data.mastodon }} on Mastodon</span>
</a>
</li>
{% endif %}
</ul>
{% endif %}
{%- endmacro -%}

0 comments on commit ae1bf3f

Please sign in to comment.