Tweet about the latest article on Middleman blog.
Add this line to your application's Gemfile:
gem 'middleman-blog-twitter'
And then execute:
$ bundle
Or install it yourself as:
$ gem install middleman-blog-twitter
Create ERB for tweet text(ex. tweet_template.txt.erb
).
Blog updated: <%= latest_article.title %> <%= hostname %><%= latest_article.url %>
name | value |
---|---|
latest_article | Middleman::Sitemap::Resource included Middleman::Blog::BlogArticle object of the latest blog article |
hostname | Your blog hostname(set in the next section) |
On config.rb
activate :blog_twitter do |twitter|
twitter.consumer_key = 'YOUR CONSUMER KEY'
twitter.consumer_secret = 'YOUR CONSUMER SECRET'
twitter.access_token = 'YOUR ACCESS TOKEN'
twitter.access_token_secret = 'YOUR ACCESS TOKEN SECRET'
twitter.hostname = 'http://example.com' # your blog hostname
twitter.template_path = 'tweet_template.txt.erb'
twitter.force_tweet = false # If true, tweet regardless of the date of latest article. (Default: false)
twitter.new_article_threshold = 1.hour # Tweet if date of latest article newer than threshold. (Default: 1.hour)
end
$ middleman tweet
then
Blog updated: <latest article title> <latest article url>
- Fork it ( http://github.com//middleman-blog-twitter/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request