Ruby page

Ruby pages are any page with the .page.rb suffix. They're very powerful for generating arbitrary
pages.

permalink_pages = files_like('*.{jpg,jpeg,png}').map do |image_path|
  page = new_page
  page.title = "Image - #{File.basename(image_path)}"
  page.tags << 'image permalink'
  page.href = File.basename(image_path)
  page.published_at = File.birthtime(image_path)
  page.attribues.image_path = image_path

  render page, with: '_permalink.html.erb'
end

page = new_page
page.title = "Image Gallery"
page.href = 'index'
page.attribues.images = permalink_pages
render page, with: '_gallery.html.erb'

This example starts with a helper that gets all the images in the folder. files_like returns an array of
image paths.

Since it's just code, you can also render the index page that is a gallary of all the images in the folder.

Ruby page methods

files_like(matcher)

Returns an array of file paths that match the matcher. It only matches files in this folder or below. The matcher
can be either in the ruby glob format or a regex.

new_page

Generates a new page object for you to use. This kinda sucks and I hope to fix it soon.

render page, with: template

This causes the page to be rendered with the given template. The template is a string that's a relative path to an
html.erb file. Check out the docs for the render context to see what variables you have within
the template.