Last active
December 25, 2015 05:29
-
-
Save ungoldman/6924992 to your computer and use it in GitHub Desktop.
middleman instance variables that are collections of pages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ... | |
def get_pages | |
# get an array of pages whose source filename contains .html | |
@pages = sitemap.resources.find_all { |page| page.source_file.match(/\.html/) } | |
# sort them by an arbitrary YAML frontmatter property called 'order' | |
@pages.sort! { |a,b| a.data['order'].to_i <=> b.data['order'].to_i } | |
end | |
ready do | |
get_pages | |
end | |
# ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment