halostatue

halostatue

TableauSocialExtension - Social Media Profile Links for Tableau

Over the last several months, I’ve been using Tableau to rebuild my long-neglected website. Tableau is part of the Elixir Tools project headed by @mhanberg, and is built on top of MDEx by @leandrocp. This library is one of ten libraries and Elixir extensions that I built. Most of these were built with the assistance of Kiro.

TableauSocialExtension is a Tableau extension that replaces <dl> and <a> tags that have specific metadata tags with social media profile links based on site configuration and content front matter. All generated links include rel="nofollow noopener noreferrer" automatically.

Social Block (<dl social-block></dl>)

Replaces the social block <dl> with a definition list with all configured social accounts. Filters may be applied for custom lists.

<dl social-block></dl>
<dl class="social-block">
  <dt class="social-platform-label social-platform-github">GitHub</dt>
  <dd class="social-links social-platform-github">
    <a
      href="https://github.com/username"
      class="social-link social-platform-github"
      rel="nofollow noopener noreferrer"
    >username</a>
  </dd>
</dl>

Individual Links (<a social-*></a>)

Replaces the <a> link anchor with a link anchor for the configured account.

<!-- Uses first configured account -->
<a social-github></a>

<!-- Uses specific account identifier -->
<a social-github="different-user">Text</a>

<!-- For platforms with lookup keys (e.g., Stack Overflow) -->
<a social-stack-overflow-id="12345"></a>
<a
  href="https://github.com/username"
  class="social-link social-platform-github"
  rel="nofollow noopener noreferrer"
>@username</a>

<a
  href="https://github.com/different-user"
  class="social-link social-platform-github"
  rel="nofollow noopener noreferrer"
>Text</a>

<a
  href="https://stackoverflow.com/users/12345"
  class="social-link social-platform-stack-overflow"
  rel="nofollow noopener noreferrer"
>Example User</a>

Configuration

TableauSocialExtension requires configuration for the social block to work, but that configuration can be global or per-page (or post).

config :tableau, TableauSocialExtension,
  accounts: [
    # Simple username
    github: "username",
    twitter: "username",
    
    # Email-style for federated platforms
    mastodon: "user@instance.social",
    pixelfed: "user@pixelfed.social",
    
    # Numeric ID with username -- custom parsing format
    stack_overflow: "12345/username",
    
    # Multiple accounts per platform (as list)
    github: ["personal-username", "work-username"],
    mastodon: ["user@instance.social", "alt@other.instance"]
  ],
  css_prefix: "social",
  labels: %{
    github: "GitHub",
    mastodon: "Mastodon"
  }

Frontmatter Overrides

---
title: About
social_accounts:
  github: page-specific-username
  mastodon: different@instance.social
---

Frontmatter settings for social_accounts override the site configurations for that page by default, but there are directives for appending or prepending the account lists.

---
title: About
social_accounts:
  github[prepend]: page-specific-username
  mastodon[append]: different@instance.social
---

https://github.com/halostatue/tableau_social_extension

Where Next?

Popular in Announcing Top

mischov
import Meeseeks.CSS html = HTTPoison.get!("https://news.ycombinator.com/").body for story &lt;- Meeseeks.all(html, css("tr.athing")) do...
New
jakub-zawislak
Hi everyone, I’m coming from the Symfony (PHP) framework. I like Phoenix, but it has a one thing that was build much better in the Symfo...
New
tmbb
I’ve been working on two packages (not on hex.pm yet) to build admin interfaces for phoenix apps: bureaucrat - which contains a bunch ...
New
oltarasenko
Dear Elixir community, After a year of development, bug fixes, and improvements, we are proudly ready to share the release of Crawly 0.1...
New
nikokozak
Hello all, I’ve been working on Svonix - a library for quickly integrating Svelte components into Phoenix views. It’s a much-needed succ...
New
kip
Image is an image processing library for Elixir. It is based upon the fabulous vix library that provides a libvips wrapper for Elixir. I...
622 18934 194
New
RobertDober
Earmark is a pure-Elixir Markdown converter. It is intended to be used as a library (just call Earmark.as_html), but can also be used as...
239 12645 134
New
Flo0807
Hello everyone! I am excited to share our heart project Backpex with you. After building several Phoenix applications, we realized that...
New
markmark206
simple_feature_flags is a tiny package that lets you turn features on or off based on which environment (e.g. localhost, staging, product...
New
marcuslankenau
I feel kind of stuck with the absence of a proper xml library for Elixir. Currently I use SweetXML which was ok for me more or less to pa...
New

Other popular topics Top

hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a &gt; b) do {:ok, "a"} end if (a &lt; b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement