jekyll plugin not work on github
github, jekyll, ruby
Solution
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.
Problem
I want to change the order of pages in navitation bar by using `jekyll-plugins / weighted_pages.rb` from here. This plugin work very well on my localhost but github. I find the navitation bar is empty on github host, which seems this plugin does not work. How can I solve this problem? I copy `weighted_pages.rb` code below: ``` # Generates a copy of site.pages as site.weighted_pages # with pages sorted by weight attribute. Pages with no # weight specified are placed after the pages with specified weight. module Jekyll class WeightedPagesGenerator < Generator safe true def generate(site) site.config['weighted_pages'] = site.pages.sort_by { |a| a.data['weight'] ? a.data['weight'] : site.pages.length } end end end ``` Add `weight` attribute to the front matter of your `pages (like weight: 1)` and use `site.weighted_pages` instead of `site.pages` in your loops.