How to Install/Use Jekyll Plugins in GitHubPages?
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.
How do I configure GitHub to use non-supported Jekyll site plugins?
Depending if you deal with a User/Organization (UO) site or a Project site (P), do :
- from your working folder
git init
git remote add origin git@github.com:userName/userName.github.io.git
(UO) orgit remote add origin git@github.com:userName/repositoryName.git
(P)jekyll new .
creates your code base- in _config.yml, set the baseurl parameter to
baseurl: ''
(UO) orbaseurl: '/repositoryName'
(P) - in .gitignore add _site, it will be versioned in the other branch
jekyll build
will create the destination folder and build site.git checkout -b sources
(UO) orgit checkout master
(P)git add -A
git commit -m "jekyll base sources"
commit your source codegit push origin sources
(UO) orgit push origin master
(P) push your sources in the appropriate branchcd _site
touch .nojekyll
, this file tells gh-pages that there is no need to buildgit init
init the repositorygit remote add origin git@github.com:userName/userName.github.io.git
(UO) orgit remote add origin git@github.com:userName/repositoryName.git
(P)git checkout master
(UO) orgit checkout -b gh-pages
(P) put this repository on the appropriate branchgit add -A
git commit -m "jekyll first build"
commit your site codegit push origin master
(UO) orgit push origin gh-pages
(P)
You now have something like Octopress does. Look at their rake file, there are some nice comments inside.
Use 'jekyll-multiple-languages-plugin' with GitHub Pages
GitHub Pages allow a limited set of plugins. You can find a list here with the versions for each plugin.
In order to run your jekyll site locally in an environment similar to GitHub Pages, you should serve it with plugins disabled, using:
jekyll serve --safe
There are ways to make Jekyll multilingual without plugins, e.g. this implementation based on this article.
If you really want to use plugins, you will have to generate your web pages locally, and push them into your GitHub repository instead of the Jekyll sources.
jekyll plugin not work on github
Github pages does not support plugins. From jekyll's documentation:
GitHub Pages is powered by Jekyll, however all Pages sites are generated using the --safe option to disable custom plugins for security reasons. Unfortunately, this means your plugins won’t work if you’re deploying to GitHub Pages.
The same documentation page also gives you a workaround:
You can still use GitHub Pages to publish your site, but you’ll need to convert the site locally and push the generated static files to your GitHub repository instead of the Jekyll source files.
Generate category page in jekyll targeting github pages
A) You can write custom scripts (shell or Ruby or whatever) to generate files anywhere using file I/O operations. In your above example, instead of adding new pages to the site, you can write out files with front-matter into your project directory. For example (Ruby):
open('somepath/#{category}/index.html', 'w') { |f|
f << "---\n"
f << "key: #{variable}\n"
f << "---\n"
}
And of course, you have to run it locally, before pushing the project to GitHub.
B) Or you can render your Jekyll site locally and push only the _site
contents to GitHub. You can then use any plugin you need. You have to create a .nojekyll
file in the project root to bypass Jekyll processing on GitHub, and you have to add it to Jekyll's includes as well (in _config.yml
):
include:
- .nojekyll
Then you can render the site (jekyll build
) and push contents of _site
directory to GitHub. You can automate this step with a little shell script.
Instructions for custom GitHub Pages deploy
Considering JamesIves/github-pages-deploy-action
can be configured to push your production-ready code into any branch you'd like, an alternative would be for your action to:
- include a
steps: - name: Replace
which would replace the text in what was checked out - deploy the current checked out (and modified) folder
For the first point, you can use for instance a find-and-replace
action, to find foo.com
and replace it with bar.com
.
Note: since you are using a GitHub Action, you can specify said action as publishing source
You can now deploy to a GitHub Pages site directly from a repository using GitHub Actions, without needing to set up a publishing source.
Using Actions to orchestrate Pages publishing provides many more options for choosing your authoring framework (Next.js, Hugo, Gatsby, Jekyll, NuxtJS or other technologies, and the associated versions thereof) as well as giving you finer control over the publishing process, such as leveraging deployment gates.
We have written several starter workflows for the most common frameworks but also have a “Static“ option if you want to deploy the contents of your repository with no build step.
- Documentation
- Starter workflows (you can modify the
static.yml
one to include your change)
Which Jekyll plugins are whitelisted by GitHub Pages?
Here's a list with the Jekyll plugins that GitHub Pages support:
https://pages.github.com/versions/
Related Topics
Rails 3.1 Actioncontroller::Routingerror (No Route Matches [Get] "/Assets/Rails.Png"):
In Ruby What Does the "Receiver" Refer To
How to Set a Custom User Agent in Ruby
Generate Ssh Keypairs (Private/Public) Without Ssh-Keygen
Ruby Regex- Does Gsub Store What It Matches
How to Enable Tls for Redis 6 on Sidekiq
Add API Key to Every Request in Activeresource
Ruby: How to Find Non-Unique Elements in Array and Print Each with Number of Occurrences
Heroku - How to Write into "Tmp" Directory
What's the Difference Between Ruby Core API and Standard Library API
How to Debug Ruby on Rails in Eclipse Aptana Plugin
Run Delayed Jobs and Sidekiq at the Same Time
How to Lazily Evaluate an Arbitrary Variable with Chef
Determine If One Array Contains All Elements of Another Array
Convert a String Date Format from "17-Nov-2011" to "11/17/11"
Phusion Passenger Is Throwing Errors After Upgrading Ruby and Rails Using Rvm
Migrating Data - Not Just Schema, Rails
Ruby: How to Generate CSV Files That Has Excel-Friendly Encoding