Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jekyll plugin not work on github

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.

like image 249
Mithril Avatar asked Dec 04 '13 07:12

Mithril


People also ask

What is a Jekyll plugin?

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.

What is Jekyll import command?

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.

How many public repositories are there for Jekyll?

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

What's new in Jekyll 3?

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)


1 Answers

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.

like image 152
Andión Avatar answered Oct 04 '22 01:10

Andión