Search code examples
facebooktwitterlinkedin-apiblogdown

blogdown: how to add social media sharing to blog post view (default theme)?


Social media sharing of blog posts is, by definition, done within the individual blog post view.

Each social media site has unique javascript to be called when the their share icon is clicked. Upon execution, a social media-specific window will appear: a) previewing the to-be-shared content (including a YAML-specified image, and YAML-specified text summary); b) prompt the user for share parameters; and c) complete the share. The shared blog post will appear in the user's social media feed, with an embedded link back to the originating blog post, and be seen by the user's social media followers/connections/friends. (A viral effect may ensue; its not uncommon for popular posts to reach millions of social media users, in turn generating substantial traffic on the blog site.)

Social media sites of interest are Twitter, LinkedIn, and Facebook.

How would I go about implementing this social media sharing functionality in blogdown's default theme (hugo-lithium)? I.e., what config.toml to add, where to add social media javascript.


Solution

  • I don't think Lithium has the necessary functionality. You could of course write it in, but it is much easier to start with a theme that supports it out of the box.
    I suggest ghostwiter - blogdown::new_site(theme = "jbub/ghostwriter").
    It is simple, clean, and its [Params] section supports various sharing options.