No blog is complete without buttons or links that invites a reader to share your articles with the friend and colleagues on various social media sites. The problem with these buttons on many sites is that the buttons are used by big companies to track your web usage, sharing that information with various companies. (For a more in-depth talk on this subject, please read the Online Trackers and Links section at the end of this page.)
Elegant provides a simple solution to this, using the
Share Post plugin from pelican to
provide simple and plain old-school URLs to provide the social media links. These have the
benefit of not having any ability to be used for online tracking.
Here is an example of what the Social Media Sharing section may look like:
To enable the Social Media Sharing links for your articles, add
share_post to the
configuration variable in your Pelican configuration.
PLUGINS = ['share_post']
Optionally, customize the list of networks where the article can be shared using
SHARE_LINKS = [ ('twitter', 'Twitter'), ('facebook', 'Facebook'), ('email', 'Email') ]
The first item in each pair refers to a network recognized by
share_post. Currently the list of supported networks includes
The sharing links are displayed in the order of
SHARE_LINKS, therefore this variable can also be used to customize the link order.
The share_post plugin requires the Python
beautifulsoup4 package to be installed.
The default text used to lead into the Social Media Sharing links is “Share On:”. This can
be overridden by defining the
SHARE_POST_INTRO configuration variable with the text you
want to replace it.
SHARE_POST_INTRO = "Share me with your friends on"
Once the configuration for Sharing Media Links is enabled in the configuration file, using this feature to provide links for your readers to share your articles on social media is completed.
The only effect any metadata field will have
on Sharing Media links is to change the text to lead into the Social Media Sharing links.
As documented above, the
SHARE_POST_INTRO can be used to provide an alternate lead in text
for the Social Media Sharing links. This text can be further overridden on an
article-by-article basis by specifying the
share_post_intro metadata field value for an
article as follows:
share_post_intro: Share this article on Elegant with
There are a plethora of social sharing widgets available online. The unfortunate problem with most of the widgets is that they are used to track users and their browsing habits. Technology watchdogs have been raising a hue and cry since as early as 2009.
Developers have responded to these concerned by coming up with different ways to cope with this issue. The solutions range from custom browser plugins to completely totally reinventing share widgets for a given browser. However, it is unreasonable to expect that each of your visitors uses a privacy plugin. Depending on your setup, your computer’s browser or mobile phone’s browser may not let your users install any kind of plugin.
Reinventing a social widget that respects the user’s concerns will certainly requiring the more educated readers about it. For other readers, the “new” or “changed” social widget will seem alien to them, and will make them hesitant to use it. In turn, that will almost definitely result in a decrease in the number of shares of your articles on social networks.
Pelican (and therefore Elegant) uses a simple approach to work around this issue. By using plain URLs to provide it’s ability to share with social media sites, the entire widget issue is avoided.