Jens Oliver Meiert

Get 15% off on select books on Gumroad—use discount code “testdrive”.

Maintainable Social Script Integration

Post from December 19, 2014 (↻ June 8, 2021), filed under .

This and many other posts are also available as a pretty, well-behaved ebook: On Web Development.

(Or go straight to GitHub.)

In my book a website embeds all those third-party share and like and +1 scripts, whether from Facebook or from Twitter or from Google (or from AddThis) like this:

<div id=social></div>

That’s it *. The reason for this brevity is maintainability. Instead of contaminating tens or hundreds or thousands of files, template or not, WETting them with different scripts and their configuration code and such, we want to just add what is structurally needed. One container. To be populated and managed through one script.

Lacking alternatives, I’ve built such a script and now added it to GitHub. “Social Widget Wrapper” I’ve called it. (This can be renamed later.) It’s actually three scripts at the moment, for I’ve worked on three different approaches. (This should be consolidated.) And as it’s getting a bit more complicated from here, I suggest you check out the project page and, if you like, help me make all of it easier and better. I’m a terrible scripter .

Oh. In other words, I’ve open-sourced a functioning but scrappy script, or three of those, that shield markup from social widgets or their scripts or so, and now throw it all at everyone around.

* …assuming an already existing site default script that takes care of the magic; otherwise we need to add another line for a script. Container and ID may be changed, sure (if appropriate).

…which may affect the Google Photo Fetcher script, too.

About Me

Jens Oliver Meiert, on September 30, 2021.

I’m Jens, and I’m an engineering lead—currently manager for Developer Experience at LivePerson—and author. I’ve worked as a technical lead for Google, I’m close to W3C and WHATWG, and I write and review books for O’Reilly. I love trying things, sometimes including philosophy, art, and adventure. Here on I share some of my views and experiences.

If you have a question or suggestion about what I write, please leave a comment (if available) or a message. Thank you!

Read More

Have a look at the most popular posts, possibly including:

Looking for a way to comment? Comments have been disabled, unfortunately.

Cover: The Web Development Glossary.

Get a good look at web development? Try The Web Development Glossary (2020). With explanations and definitions for literally thousands of terms from Web Development and related fields, building on Wikipedia as well as the MDN Web Docs. Available at Apple Books, Kobo, Google Play Books, and Leanpub.

Stay up-to-date? Learn about new posts by feed or on Twitter.

Found a mistake? Email me,

You are here: HomeArchive2014 → Maintainable Social Script Integration

Last update: June 8, 2021

Professional frontend developers produce valid HTML and CSS.