markdownjekyllgithub-pagesjekyll-extensions

How to Install/Use Jekyll Plugins in GitHubPages?


I've created a GitHubPage together with Jekyll, and currently I'm trying to use some of the basic plugins that are available. So far nothing fancy, I'm using the whitelisted plugins, specifically this one. It opens links in new tabs, which isn't supported by default in Markdown.

So far, I've created the site using myusername.github.io repo, cloned it to local, and created a basic site using jekyll new . as is instructed here. Then I pushed all changes to GitHub and it's all working fine.

Then, to install the above mentioned plugin, I followed the steps mentioned in the help section, namely, these things:


Add the following to your site's Gemfile

gem 'jekyll-target-blank'

and add the following to your site's _config.yml

plugins:
  - jekyll-target-blank

Also, note that by default the Gemfile has the following section with the instructions below:

# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
gem "jekyll", "~> 3.8.3"

# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem "minima", "~> 2.0"

# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
# gem "github-pages", group: :jekyll_plugins

So I changed the Gemfile as it's instructed there and ran bundle update github-pages.

Now my Gemfile looks like this in full:

source "https://rubygems.org"

# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
#     bundle exec jekyll serve
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
# gem "jekyll", "~> 3.8.3"

# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem "minima", "~> 2.0"

# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
gem "github-pages", group: :jekyll_plugins

# If you have any plugins, put them here!
group :jekyll_plugins do
  gem "jekyll-feed", "~> 0.6"
  gem 'jekyll-target-blank'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]

# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.0" if Gem.win_platform?

Note that I've commented/uncommented the proper sections.

And my _config.yml looks like this:

title: xxxxxx
email: xxxxxx
description: >- # this means to ignore newlines until "baseurl:"
  xxxxxx.
baseurl: "" # the subpath of your site, e.g. /blog
url: "" # the base hostname & protocol for your site, e.g. http://example.com

github_username:  xxxxxx
instagram_username: xxxxxx

# Build settings
markdown: kramdown
theme: minima
plugins:
  - jekyll-feed
  - jekyll-target-blank

Then I did a

bundle exec jekyll serve

to locally run it at http://127.0.0.1:4000/ and the plugin works fine. By clicking a link written as below it opens the link in a new tab as it should.

[LinkText](link)

However, when I push it all to GitHub, the plugin doesn't work. It still opens the link on the same tab.

What am I doing wrong?


Solution

  • I'm the developer of Jekyll Target Blank. GH Pages only support some plugins https://help.github.com/articles/adding-jekyll-plugins-to-a-github-pages-site/. I have requested for this plugin to become supported but they their response was a maybe.