jekyll-twitter-plugin 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +52 -19
- data/jekyll-twitter-plugin.gemspec +1 -1
- data/lib/jekyll-twitter-plugin.rb +6 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da29e624fad543de4ea74ed5a5d44dd868ae9468
|
4
|
+
data.tar.gz: 6d01a8bdf2f03668f4848835cbda7e5f0edca03a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e5545d32edf1ea675d569baff3907801619f8df5f9348a9f82a7c12097594ab94226cd70954a1eeda6da8c17ff1790cb05b15db8a8f81bad836b3c3968738b8
|
7
|
+
data.tar.gz: 56e1fede9de06facbe5cd41340448a5a316376979903afc1c75fa65a7aed2e94eb119732eb5c3413b54ecc6672c41ee52f29e1f014eda3725fad3bd5ef21de95
|
data/README.md
CHANGED
@@ -4,26 +4,28 @@ A Liquid tag plugin for Jekyll that renders Tweets from Twitter API.
|
|
4
4
|
|
5
5
|
[](http://badge.fury.io/rb/jekyll-twitter-plugin)
|
6
6
|
|
7
|
+
|
7
8
|
### Description
|
8
9
|
|
9
|
-
A Liquid tag plugin for [Jekyll](http://jekyllrb.com/) that
|
10
|
+
A Liquid tag plugin for [Jekyll](http://jekyllrb.com/) that enables Twitter content to be used in any content served by Jekyll, content is fetched from the [Twitter API](https://dev.twitter.com/home).
|
10
11
|
|
11
|
-
It is based on the original Jekyll Tweet Tag from [scottwb](https://github.com/scottwb/jekyll-tweet-tag) which has not been updated since Twitter updated their API to require Oauth.
|
12
|
+
It is based on the original Jekyll Tweet Tag from [scottwb](https://github.com/scottwb/jekyll-tweet-tag) which has not been updated since Twitter updated their API to require Oauth. This version uses the excellent [Twitter gem](https://github.com/sferik/twitter) to make requests and handle authentication.
|
12
13
|
|
13
|
-
This plugin replaces the broken plugin mentioned above and uses a different tag and API
|
14
|
+
This plugin replaces the broken plugin mentioned above and uses a different tag name and API - this is by design so that the two plugins can be used, if the original gets fixed.
|
14
15
|
|
15
16
|
|
16
17
|
### Features
|
17
18
|
|
18
|
-
The plugin supports the following features
|
19
|
+
The plugin supports the following features:
|
19
20
|
|
20
|
-
*
|
21
|
-
*
|
21
|
+
* Installed via Rubygems
|
22
|
+
* [Oembed](#oembed) - Embed a Tweet in familiar Twitter styling.
|
23
|
+
* [Caching](#caching) - Twitter API responses can be cached to avoid hitting request limits.
|
22
24
|
|
23
25
|
|
24
26
|
### Requirements
|
25
27
|
|
26
|
-
*
|
28
|
+
* Twitter oauth credentials - Most Twitter api functions now require authentication. Set up your [application](https://dev.twitter.com/apps/new) and get the credentials.
|
27
29
|
|
28
30
|
|
29
31
|
### Usage
|
@@ -32,47 +34,78 @@ As mentioned by [Jekyll's documentation](http://jekyllrb.com/docs/plugins/#insta
|
|
32
34
|
|
33
35
|
#### Require gem
|
34
36
|
|
37
|
+
Install the gem, add it to your Gemfile;
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
gem 'jekyll-twitter-plugin'
|
41
|
+
```
|
42
|
+
|
35
43
|
Add the `jekyll-twitter-plugin` to your site `_config.yml` file for Jekyll to import the plugin as a gem.
|
36
44
|
|
37
45
|
```ruby
|
38
|
-
gems: [jekyll-twitter-plugin]
|
46
|
+
gems: ['jekyll-twitter-plugin']
|
39
47
|
```
|
40
48
|
|
41
49
|
#### Manual import
|
42
50
|
|
43
51
|
Just download the source file into your `_plugins` directory, e.g.
|
44
52
|
|
45
|
-
|
53
|
+
```bash
|
54
|
+
# Create the _plugins dir if needed and download project_version_tag plugin
|
55
|
+
$ mkdir -p _plugins && cd _plugins
|
56
|
+
$ wget https://raw.githubusercontent.com/rob-murray/jekyll-twitter-plugin/master/lib/jekyll-twitter-plugin.rb
|
57
|
+
```
|
58
|
+
|
59
|
+
#### Credentials
|
60
|
+
|
61
|
+
Your Twitter application authentication credentials are private - do not distribute these! As such this plugin requires your credentials as Environment variables, it requires the following keys to be set;
|
62
|
+
|
63
|
+
* **TWITTER_CONSUMER_KEY**
|
64
|
+
* **TWITTER_CONSUMER_SECRET**
|
65
|
+
* **TWITTER_ACCESS_TOKEN**
|
66
|
+
* **TWITTER_ACCESS_TOKEN_SECRET**
|
67
|
+
|
68
|
+
```bash
|
69
|
+
$ export TWITTER_CONSUMER_KEY=foo etc.
|
70
|
+
```
|
46
71
|
|
47
72
|
#### Plugin tag usage
|
48
73
|
|
49
74
|
To use the plugin, in your source content use the tag `twitter` and then pass additional parameters to the plugin.
|
50
75
|
|
51
76
|
```ruby
|
52
|
-
{%
|
77
|
+
{% plugin_type api_type params %}
|
53
78
|
```
|
54
79
|
|
55
|
-
|
80
|
+
* `plugin_type` - Either `twitter` or `twitternocache`.
|
81
|
+
* `api_type` - The Twitter API to use, check below for supported APIs.
|
82
|
+
* `params` - Parameters for the API separated by spaces.
|
56
83
|
|
57
|
-
|
84
|
+
### Supported Twitter APIs
|
85
|
+
|
86
|
+
The following Twitter APIs are supported.
|
58
87
|
|
59
88
|
#### Oembed
|
60
89
|
|
61
|
-
|
90
|
+
The [oembed](https://dev.twitter.com/rest/reference/get/statuses/oembed) API returns html snippet to embed in your app, this will be rendered in the familiar Twitter style.
|
62
91
|
|
63
|
-
|
92
|
+
```ruby
|
93
|
+
{% twitter oembed status_url %}
|
94
|
+
# Example
|
95
|
+
{% twitter oembed https://twitter.com/rubygems/status/518821243320287232 %}
|
96
|
+
```
|
97
|
+
|
98
|
+
### Output
|
64
99
|
|
65
100
|
As with the original plugin, all content will be rendered inside a div with the classes 'embed' and 'twitter'
|
66
101
|
|
67
|
-
```
|
102
|
+
```html
|
68
103
|
<div class='embed twitter'>
|
69
|
-
content
|
104
|
+
-- content --
|
70
105
|
</div>
|
71
106
|
```
|
72
107
|
|
73
|
-
|
74
|
-
|
75
|
-
If the request cannot be processed then a basic error message will be displayed;
|
108
|
+
If something goes wrong then a basic error message will be displayed;
|
76
109
|
|
77
110
|
> Tweet could not be processed
|
78
111
|
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'jekyll-twitter-plugin'
|
7
|
-
spec.version = '1.0.
|
7
|
+
spec.version = '1.0.1'
|
8
8
|
spec.authors = ['Rob Murray']
|
9
9
|
spec.email = ['robmurray17@gmail.com']
|
10
10
|
spec.summary = 'A Liquid tag plugin for Jekyll that renders Tweets from Twitter API'
|
@@ -91,9 +91,9 @@ module TwitterJekyll
|
|
91
91
|
end
|
92
92
|
|
93
93
|
class UnknownTypeClient
|
94
|
-
|
94
|
+
include TwitterJekyll::Cacheable
|
95
95
|
|
96
|
-
def
|
96
|
+
def fetch; end
|
97
97
|
end
|
98
98
|
|
99
99
|
class TwitterTag < Liquid::Tag
|
@@ -151,10 +151,10 @@ module TwitterJekyll
|
|
151
151
|
|
152
152
|
def create_twitter_rest_client
|
153
153
|
@twitter_client = Twitter::REST::Client.new do |config|
|
154
|
-
config.consumer_key = ENV.fetch('
|
155
|
-
config.consumer_secret = ENV.fetch('
|
156
|
-
config.access_token = ENV.fetch('
|
157
|
-
config.access_token_secret = ENV.fetch('
|
154
|
+
config.consumer_key = ENV.fetch('TWITTER_CONSUMER_KEY')
|
155
|
+
config.consumer_secret = ENV.fetch('TWITTER_CONSUMER_SECRET')
|
156
|
+
config.access_token = ENV.fetch('TWITTER_ACCESS_TOKEN')
|
157
|
+
config.access_token_secret = ENV.fetch('TWITTER_ACCESS_TOKEN_SECRET')
|
158
158
|
end
|
159
159
|
end
|
160
160
|
end
|