Skip to content

Instantly share code, notes, and snippets.

@ungoldman
Last active December 25, 2015 05:29
Show Gist options
  • Save ungoldman/6924992 to your computer and use it in GitHub Desktop.
Save ungoldman/6924992 to your computer and use it in GitHub Desktop.
middleman instance variables that are collections of pages
# ...
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