Skip to content

Latest commit

 

History

History
40 lines (26 loc) · 1.44 KB

2 - How to override a view.textile

File metadata and controls

40 lines (26 loc) · 1.44 KB

How to override a view

The default HTML Refinery generates on the front end is sometimes not suitable for your design. This guide will show you how to:

  • Override a front end view in Refinery and replace it with your own version

endprologue.

Overriding your first view

If you want to override one of the views Refinery comes built with (for example, to add a phone number to the footer), you’ll need to override the view Refinery is providing. Refinery will then use your local version, rather than its original copy.

It’s easy to get a copy of this file to modify locally. For example, for the footer, just run in the terminal:

$ rake refinery:override view=shared/_footer.html

Or, if you are using an old version of Refinery with a theme installed, try:

$ rake refinery:override view=shared/_footer.html theme=mytheme

Common Examples

These are files we often override when creating a Refinery site.

$ rake refinery:override view=pages/show
$ rake refinery:override view=pages/home
$ rake refinery:override view=shared/_content_page

Tips and Tricks

  • Trim the ‘.erb’ from the end of the view file name
  • Only override when you really need to, as it makes upgrading to future versions of Refinery trickier
  • You only need the path to the view from inside the ‘views’ folder, regardless of which engine the file is in
  • This will also work to override views in plugins you’ve created locally