Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ibrado/jekyll-tweetsert
Jekyll Tweetsert - import Twitter statuses (tweets) as posts
https://github.com/ibrado/jekyll-tweetsert
jekyll jekyll-plugin twitter
Last synced: 2 months ago
JSON representation
Jekyll Tweetsert - import Twitter statuses (tweets) as posts
- Host: GitHub
- URL: https://github.com/ibrado/jekyll-tweetsert
- Owner: ibrado
- License: mit
- Created: 2017-12-05T09:30:39.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-28T21:34:03.000Z (almost 7 years ago)
- Last Synced: 2024-04-29T22:06:40.611Z (9 months ago)
- Topics: jekyll, jekyll-plugin, twitter
- Language: Ruby
- Homepage:
- Size: 54.7 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Jekyll::Tweetsert
[![Gem Version](https://badge.fury.io/rb/jekyll-tweetsert.svg)](https://badge.fury.io/rb/jekyll-tweetsert)
*Tweetsert* is a plugin for Jekyll that pulls recent tweets from one or more Twitter handles, then inserts them (dated appropriately) as regular posts on your site. You can specify which tweets to include or exclude based on patterns or words, import retweets and replies, and tweak the theme and link colors of the embedded tweet.
To organize your tweet-posts, Tweetsert can automatically assign a category and/or tag. You may also choose to automatically import Twitter hashtags.
## Why do this?
1. You want your blog readers to also see your recent tweets when they visit;
1. You may want to pull in tweets from friends, family, co-workers, etc. into your blog;
1. You want to create a blog composed only of tweets from a group of people;
1. Just for fun!## What's new?
*v1.1.1* Change cache location, allow inclusion in `_config.yml`
*v1.1.0* Added `prefix` and `suffix` options to `embed`
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'jekyll-tweetsert'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install jekyll-tweetsert
In compliance with the spirit of Twitter's API usage guidelines, you will need an access token. Get it here:
> **[tweetsert.hook.io](http://tweetsert.hook.io)**
You will be directed to Twitter's OAuth system. Once you grant permission (read-only), you will be presented with a token that you then place into your `_config.yml`. If you don't want to do that, you may use the environment variable **`JTP_ACCESS_TOKEN`** instead.
$ export JTP_ACCESS_TOKEN="..."
$ jekyll serve## Usage
The minimum configuration to run *Tweetsert* is the following:
```yaml
tweetsert:
enabled: true
timeline:
handle: 'ibrado'
access_token: "12345678-aBcDeFgHiJkLmNoPqRsTuVwXyZajni01234567890"
```Here is a sample `_config.yml` section, with comments:
```yaml
tweetsert:
enabled: true
layout: "tweet" # Template in _layouts to use; default "page"# Show additional messages for debugging
#debug: true# Prefix, number of words, and suffix of the generated titles
title:
#prefix: "[Tweet] "
words: 9
suffix: " ..."# Some post/page properties you may want to set automatically
#properties:
# is_tweet: true
# tweet_html: $ # the embedded tweet
# share: false
# comments: true# The timeline(s) you import, and which tweets you want/don't want
timeline:
# Your handle; you may also just use 'handles' below
handle: 'ibrado'# Other handles you want to include
# If you get an 404 Not Found, you may have misspelled a handle
#handles:
# - 'somehandle'
# - 'anotherhandle'# The token you got via tweetsert.hook.io
# You may also use the JTP_ACCESS_TOKEN environment variable instead
access_token: "12345678-aBcDeFgHiJkLmNoPqRsTuVwXyZajni01234567890"# Timeline entries to retrieve. Limited by Twitter to 200; default 100
# Note that this includes deleted tweets, so it's not exact
limit: 100# Include tweets starting with @handle; default: false
#replies: true# Include retweets (RT); default false
#retweets: true# If both include and exclude are configured below,
# only tweets pulled in by "include" will be further filtered by "exclude"# Only include tweets that have these words/handles/hashtags/URLs
# (case insensitive regex)
#include:
#- '#blog'
#- '(^|[^@\w])@(\w{1,15})\b' # Must mention @someone
#- 'important'
#- '@handle'# Exclude tweets that have these words/handles/hashtags/URLs
# (case insensitive regex)
exclude:
- 'https://example.org/\d+/' # Your own blog posts
- '^.@' # Tweets that start with .@someone
#- 'ignore'
#- '#somehash'
#- '@handle'# Do not include tweets newer than your latest post; default true
#no_newer: false# Do not include tweets older than your first post; default true
#no_older: falseembed:
# Set to false if you don't want the excerpt to be set; default true
#excerpts: false# Set to dark if you want a dark background/light text; default: light
#theme: "dark"# Base color of the links, default: set by Twitter
#link_color: "#80FF80"# Include Twitter's oEmbed API script every time; default: false
# Set to true if you manually include it in e.g. the header
#omit_script: true# Some markup to include right before and after the embedded tweet
# {{anything}} will be expanded to the corresponding frontmatter/properties
#prefix: 'This was tweeted on {{date}}'
#suffix: 'This is after. Click here to view this tweet separately.'category:
default: "tweets" # Automatically set to this category
dir: "" # Folder that contains your categories
#dir: "categories" # Defaultlayout: "cat_index" # What layout to use, inside _layouts
#layout: "category_index" # Default#title:
# prefix: "Posts in the «" # Prefix of the generated title
# suffix: "» category" # Suffix of the generated titletags:
#default: "tweet" # Tag all tweets automatically with this
dir: "tag" # Location of the generated tag indices
layout: "tag_index" # As above, for tags
#title:
# prefix: "Posts tagged “"
# suffix: "”"hashtags: true # Import #hashtags as site tags
# Hashtags you don't want to import
ignore:
- blahblah# Automatic tagging based on content, tag:
#auto:
# keepkey: "@bitcoinkeepkey"
# ethereum: "ethereum"
# pets:
# - buzzfeedanimals
# - Duchess
# - Princess
# - Athos```
Here's another one, cleaned-up:
```yaml
tweetsert:
enabled: true
layout: "post"
debug: falsetitle:
prefix: "[Tweet] "
words: 9
suffix: " ..."properties:
is_tweet: true
tweet_html: $
share: false
comments: truetimeline:
handle: 'ibrado'handles:
- 'somehandle'
- 'anotherhandle'access_token: "12345678-aBcDeFgHiJkLmNoPqRsTuVwXyZajni01234567890"
limit: 100replies: false
retweets: true#include:
# - '#blogimport'exclude:
- 'https://example.org/\d+/'
- '^.@'no_newer: true
no_older: falseembed:
excerpts: true
theme: "dark"
link_color: "#80FF80"
omit_script: false
prefix: 'I tweeted this on {{date}}'
suffix: 'Click here to comment.
'category:
default: "tweets"
dir: ""layout: "category_index"
title:
prefix: "Posts in the «"
suffix: "» category"tags:
default: "tweet"
dir: "tag"layout: "tag_index"
title:
prefix: "Posts tagged “"
suffix: "”"hashtags: true
ignore:
- "blahblah"auto:
keepkey: "@bitcoinkeepkey"
cryptocurrency: [ "bitcoin", "ethereum", "litecoin" ]
ethereum:
- "ethereum"
- "@ethereumproject"```
## Cache
*Tweetsert* caches Twitter's timelines and oEmbed results in a hidden folder in your home, `.jekyll-plugins/jekyll-tweetsert`. You may delete this if you encounter problems that you think might be related to the cache.
## Further configuration
You may want to edit your `home`/index layout to make the imported tweets look different from the regular ones, for instance,
```html
{% for post in site.posts %}
{% if post.tags contains "tweet" %}
{% else %}
{% endif %}
{% endfor %}
```The embedded tweet is wrapped inside a `
`, with `embed.prefix` inserted before, and `embed.suffix` after. You may adjust its appearance via CSS:```css
.jekyll-tweetsert {
clear: both;
width: auto;
margin-left: auto;
margin-right: auto;
max-width: max-content;
}
```If you'd rather access the embedded tweet directly, use a property:
```yaml
properties:
tweet: $
```and include it in your layout as `{{ page.tweet }}` or `{{ post.tweet }}`. You may want to do this since `{{ content }}` includes the contents of `embed.prefix` and `embed.suffix` and you'd rather exclude them to further tweak the appearance via a custom layout.
This has the nice side-effect of being able to do things like:
```html
{% if page.tweet %}The following is a tweet:
{{ page.tweet }}
{% else %}
{{ content }}
{% endif %}
```## Demo
See the [author's blog](https://ibrado.org) for a demo.
## Contributing
1. Fork this project: [https://github.com/ibrado/jekyll-tweetsert/fork](https://github.com/ibrado/jekyll-tweetsert/fork)
1. Clone it (`git clone git://github.com/your_user_name/jekyll-tweetsert.git`)
1. `cd jekyll-tweetsert`
1. Create a new branch (e.g. `git checkout -b my-bug-fix`)
1. Make your changes
1. Commit your changes (`git commit -m "Bug fix"`)
1. Build it (`gem build jekyll-tweetsert.gemspec`)
1. Install and test it (`gem install ./jekyll-tweetsert-*.gem`)
1. Repeat from step 5 as necessary
1. Push the branch (`git push -u origin my-bug-fix`)
1. Create a Pull Request, making sure to select the proper branch, e.g. `my-bug-fix` (via https://github.com/*your_user_name*/jekyll-tweetsert)Bug reports and pull requests are welcome on GitHub at [https://github.com/ibrado/jekyll-tweetsert](https://github.com/ibrado/jekyll-tweetsert). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
## Code of Conduct
Everyone interacting in the Jekyll::Tweetsert project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/jekyll-tweetsert/blob/master/CODE_OF_CONDUCT.md).## Also by the author
[Jekyll Stickyposts Plugin](https://github.com/ibrado/jekyll-stickyposts) - Move/pin posts tagged `sticky: true` before all others. Sorting on custom fields supported, collection and paginator friendly.
[Jekyll::Paginate::Content](https://github.com/ibrado/jekyll-tweetsert) - Split your Jekyll pages, posts, etc. into multiple pages automatically. Single-page view, pager, SEO support, self-adjusting links, multipage-aware Table Of Contents.
[Jekyll::ViewSource](https://github.com/ibrado/jekyll-viewsource) - Generate pretty or plain HTML and/or Markdown source code pages.