Skip to content

Instantly share code, notes, and snippets.

@magnetised
Created January 23, 2013 13:53
Show Gist options
  • Save magnetised/4605834 to your computer and use it in GitHub Desktop.
Save magnetised/4605834 to your computer and use it in GitHub Desktop.
An example of a content type with multiple outputs
class IntegratedPage < Page
# Define multiple outputs for this page. Each one will be accessible by adding
# the relevant extension to the page's URL. e.g.
# /my-page => HTML
# /my-page.xml => XML
# /my-page.rss => RSS
outputs :html, :rss, :json, :xml
# If the output specified doesn't map to the extension of a a known MIME type
# then you can define the format manually.
# /my-page.mobile => HTML
# /my-page.custom => Plain text
add_output :mobile, :format => :html
add_output :custom, :mimetype => "text/plain"
# We can generate anything, so why not have the CMS generate a PHP application...?
# /my-page.php => Calls out generated PHP source file
add_output :php, :language => "php"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment