jekyll / jekyll-paginate

NO LONGER UNDER ACTIVE DEVELOPMENT as of Jekyll 3: Pagination Generator for Jekyll

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow to exclude certain categories from paginated posts

parkr opened this issue · comments

Note: any post that have hidden: true in his front matter is ignored from pagination. And from what I saw in the code, it's the only use of this variable.

Ok Specs are here. Hope ready for Jekyll 3.0 FTW!

module Jekyll
  module ExceptFilter
    # Filter an array of objects, inverse of where
    #
    # input - the object array
    # property - property within each object to filter by
    # value - value to filter out
    #
    # Returns the filtered array of objects
    def except(input, property, value)
      return input unless input.is_a?(Enumerable)
      input = input.values if input.is_a?(Hash)
      input.select { |object| item_property(object, property) != value }
    end
  end
end

Liquid::Template.register_filter(Jekyll::ExceptFilter)

Thanks @djacquel for pointing out the hidden option

Since exclude doesn't work yet, is it possible to give the pagination: front matter multiple categories? I want all posts to show on my main page except for one category.

Since exclude doesn't work yet, is it possible to give the pagination: front matter multiple categories? I want all posts to show on my main page except for one category.

I would like this too. Using hidden: true hides the post both from the homepage and the category pages (I am using Jekyll Paginate v2)