Skip to content

Instantly share code, notes, and snippets.

@azzaea
Forked from abhisheknaik96/twitterJekyllEmbed.md
Created June 13, 2020 07:18
Show Gist options
  • Save azzaea/83d3fc4816e2506b3f9c4a375fc07fa3 to your computer and use it in GitHub Desktop.
Save azzaea/83d3fc4816e2506b3f9c4a375fc07fa3 to your computer and use it in GitHub Desktop.
A tutorial on embedding a twitter stream to a Jekyll project.

Embedding a twitter stream in Jekyll

  1. Create a _plugins folder in your root.
  2. Add the following to _config.yml
plugins:
  - jekyll-gist
  1. If you don't have a Gemfile associated with your Jekyll project, create one with the following text
source 'https://rubygems.org'
group :jekyll_plugins do
    gem 'github-pages'
end
  1. Add the following to your Gemfile:
gem 'jekyll-twitter-plugin'
  1. Now you're ready to add the following tags in your html. (Check out more attributes from the Twitter API)
<div class='jekyll-twitter-plugin' align="center">
    {% twitter https://twitter.com/anaik96 maxwidth=500 limit=5 %}
</div>
  1. The job isn't done yet. The feed will show on your localhost, but not Gihub Pages, which will block all plugins because of safety reasons... -_-
    No problemo, just copy the generated content from _sites folder and replace the html of step 5! :)

Sources

  1. Github - jekyll-twitter-plugin
  2. Setting up your GitHub Pages site locally with Jekyll
  3. Documentation - Jekyll Plugins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment