Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ paginate:
title_suffix: " - page :num" # Append to template's page title
category: '' # Paginate items in this category
categories: [] # Paginate items in any of these categories
exclude_category: '' # Exclude items in this category
exclude_categories: [] # Exclude items in any of those categories
tag: '' # Paginate items tagged with this tag
tags: [] # Paginate items tagged with any of these tags
```
Expand Down
8 changes: 8 additions & 0 deletions lib/octopress-paginate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ def paginate(page)
page.data['paginate']['categories'] = Array(category)
end

if exclude_category = page.data['paginate']['exclude_category']
page.data['paginate']['exclude_categories'] = Array(exclude_category)
end

add_pages(page)
end

Expand Down Expand Up @@ -143,6 +147,10 @@ def collection(page)
collection = collection.reject{|p| (p.categories & categories).empty?}
end

if exclude_categories = page.data['paginate']['exclude_categories']
collection = collection.reject{|p| !(p.categories & exclude_categories).empty?}
end

if tags = page.data['paginate']['tags']
collection = collection.reject{|p| (p.tags & tags).empty?}
end
Expand Down