A Liquid tag for Jekyll that allows for the embedding of suggested tweets via Twitter’s Web Intents API
Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE.txt
README.md
suggested-tweet.rb

README.md

Suggested Tweet Tag

A Liquid tag for Jekyll that allows for the embedding of suggested tweets via Twitter’s Web Intents API.

(John did all wranglin’ of Rich’s code. I just bought him pizza and told him what I wanted.)

Big Thanks

This plugin is based upon Rich Hollis’s Twitter Web Intents Ruby Gem.

Please note that you’ll need to install the Twitter Web Intents gem as it’s required.

Installation

  1. Copy suggested-tweet.rb into your site’s _plugins directory
  2. Install twitter_web_intents gem, either manually or via Bundler
  3. Add desired parameters (see Configuration) to _config.yml
  4. Add desired parameters to YAML front-matter of page
  5. Add {% suggested_tweet %} tag to your post or template.

Configuration

The following parameters may be set globally in _config.yml or on a per page basis in the YAML front-matter. Parameters set in the YAML front-matter take precedence over those set in _config.yml. Note that all parameters are optional.

suggested_tweet:
  url:                  'http://davidensinger.com/'
  via:                  'davidensinger'
  text:                 'Hello world'
  in_reply_to:          331434728957833218
  hashtags:             ['Jekyll', 'Twitter']
  related:              ['davidensinger', 'richhollis', '2john4tv']

Usage

{% suggested_tweet %}

Output

https://twitter.com/intent/tweet?hashtags=Jekyll,Twitter&in_reply_to=331434728957833218&related=davidensinger,richhollis,2john4tv&text=Hello+world&url=http%3A%2F%2Fdavidensinger.com&via=davidensinger

Liquid Output for Parameters

As an example we’ll use the text parameter:

  • _config.yml: {{ site.suggested_tweet.text }}
  • YAML front matter: {{ page.suggested_tweet.text }}

Todo

  • Add option to combine parameters set in both _config.yml and YAML front-matter of page, i.e. hashtags and related.

Contribute

Please do!