The Linux Rain Linux General/Gaming News, Reviews and Tutorials

The Importance of Static Social Media Buttons

By Andrew Powell, published 13/05/2017 in Editorials


So, let's talk social media buttons. You know them; you probably see them on most sites that you visit these days. The little badges or icons that load, encouraging you to click on them to either connect with the associated social media account or to share the article you may be reading at the time. If you're a web author or developer, I would strongly encourage you to use static badges or buttons instead.

I eat my own dog food in this regard, too, so to speak. If you look at the "Follow Us" links in this site's sidebar, although they have pretty enough icons, they are in fact just plain old static HTML links.

Similarly, the "Share This" buttons at the bottom of the articles here are also, you guessed it, just plain static HTML links, with a bit of extra CSS to give them some colour and size. The share links are quite recent, while the follow links in the sidebar have been around for quite some time. I actually implemented them over the original "copy/paste javascript-y" social media buttons a few years ago, as detailed in this article from 2014.

Regardless of what you think about the individual social networking sites themselves, there's no doubt they are useful for sharing content and getting blog posts like this one to reach more people, and, of course, getting more readers to follow your content (though good old RSS is still a thing, y'know).

But let's face it, as I said back in 2014, those dynamic "easy" copy and paste kind of social media buttons are ugly and obtrusive. I mean, sure, the badges with the dynamic "counters" provide a little extra something and some people must find them useful, but I'm not sure they are the be all and end all.

Plus, they increase page load times and introduce more trackers onto the page. And I feel, though many people DO use Facebook anyway, it wouldn't be fair to thrust Facebook trackers onto website visitors that do in fact actively avoid anything to do with Facebook. Granted, those people probably already run extensions in their browser to block those buttons and use things like Privacy Badger to block unwanted trackers. But why rely on people to block these things when you can just not put the nasties there in the first place?

Go Static

You can still have links to social media profiles and even links that allow someone to share directly to a social media feed of their choosing. Just, you know... do the old fashioned HTML links.

The code for sharing links can be as simple as this:

<a class="googleplus" href="https://plus.google.com/share?url={{ link }}">Google+</a> |
<a class="twitter" href="https://twitter.com/share?url={{ link }}" class="button">Twitter</a> |
<a class="facebook" href="https://www.facebook.com/sharer/sharer.php?u={{ link }}">Facebook</a>

The {{ link }} part is just there as a placeholder for the actual link you would put there. And how that becomes a link, will depend on your CMS or other website authoring software.

For The Linux Rain (KirbyCMS) it's basically this:

<div class="share-links">
    <h4>Share This</h4>
    <a class="googleplus" href="https://plus.google.com/share?url=<?php echo urlencode($page->url()); ?>">Google+</a> |
    <a class="twitter" href="https://twitter.com/share?url=<?php echo urlencode($page->url()); ?>&text=<?php echo urlencode($page->title()); ?>" class="button">Twitter</a> |
    <a class="facebook" href="https://www.facebook.com/sharer/sharer.php?u=<?php echo urlencode($page->url()); ?>">Facebook</a>
</div>

Granted, I understand some people can't be bothered or even don't have the know how to do this kind of thing, where maybe copy and pasting some ready made Javascript code from somewhere that handles the rest is a whole lot easier.

Doing static buttons for your actual social media profiles is obviously self-explanatory. You just create links to the URL of your social media account of choosing. Easy.

But still, hopefully you can see where I'm coming from. Static links do all the basic functionality you need for them to allow visitors to find your social media profile or share posts to their social media feed. And, given static links won't include any unwanted trackers or cause an increase in page load time, it's a no-brainer for me. Yes, I know this site still has ads on it, but in future that will hopefully not be the case.

Anyway, search engines (preferably something like DuckDuckGo) are your friend and will turn up plenty of tutorials on adding and styling static social media buttons. It's a bit of extra fiddling around, but I think it's worth it.



About the author

Andrew Powell is the editor and owner of The Linux Rain who loves all things Linux, gaming and everything in between.

Tags: editorials foss linux freedom open-source social-media
blog comments powered by Disqus