Jekyll plugin not working on github

I want to reorder the pages in the navigation bar using jekyll-plugins / weighted_pages.rb from here .

This plugin works very well on my localhost but github.
I find the navigation bar is empty on the github host which seems like this plugin is not working.
How can I solve this problem?

Copy the 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 a weight attribute to the front of your pages (like weight: 1) and use site.weighted_pages instead of site.pages in your loops.

+3
source share
1 answer

Github pages do not support plugins. From jekyll's documentation :

GitHub Pages runs on Jekyll, however all page sites are created using the -safe option to disable custom plugins for security reasons. Unfortunately, this means that your plugins will not work if you deploy them to GitHub pages.

On the same documentation page you will also find a workaround:

You can still use the GitHub pages to publish your site, but you will need to copy the site locally and direct the generated static files to the GitHub repository instead of the Jekyll source files.

+4
source

Source: https://habr.com/ru/post/1388164/


All Articles