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.
A Jekyll plugin that generates photo galleries from directories full of images. Liquid tag for displaying GitHub Gists in Jekyll sites. Jekyll plugin to propagate the `site.github` namespace and set default values for use with GitHub Pages.
The "jekyll import" command for importing from various blogs to Jekyll format. A Jekyll plugin to provide powerful supports for table, mathjax, plantuml, mermaid, emoji, video, audio, youtube, vimeo, dailymotion, soundcloud, spotify, etc.
Here are 305 public repositories matching this topic... A Jekyll plugin that provides users with a traditional CMS-style graphical interface to author content and administer Jekyll sites. A simple Ruby Gem to bootstrap dependencies for setting up and maintaining a local Jekyll environment in sync with GitHub Pages
A Jekyll plugin to add metadata tags for search engines and social networks to better index and display your site's content. Seamlessly specify multiple redirections URLs for your pages and posts. Streamline your writing in Jekyll with these commands. Pagination Generator for Jekyll 3 (enhanced replacement for the old built-in jekyll-paginate gem)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With