Class: Locomotive::Steam::Middlewares::PageNotFound
- Inherits:
-
ThreadSafe
- Object
- ThreadSafe
- Locomotive::Steam::Middlewares::PageNotFound
- Includes:
- Concerns::Helpers, Concerns::Rendering
- Defined in:
- lib/locomotive/steam/middlewares/page_not_found.rb
Overview
When rendering the page, the developer can stop it at anytime by raising an PageNotFoundException exception. Instead of the page, the 404 not found page will be rendered.
This is particularly helpful with the dynamic routing feature to avoid duplicated page content (different urls, same HTTP 200 code but same blank page).
Constant Summary
Constants included from Concerns::Helpers
Concerns::Helpers::CACHE_HEADERS, Concerns::Helpers::HTML_CONTENT_TYPE, Concerns::Helpers::HTML_MIME_TYPES
Instance Attribute Summary
Attributes inherited from ThreadSafe
Instance Method Summary collapse
Methods included from Concerns::Helpers
#html?, #inject_cookies, #json?, #log, #make_local_path, #modify_path, #mounted_on, #redirect_to, #render_response
Methods inherited from ThreadSafe
#call, #decorate_entry, #default_liquid_context, #default_locale, #liquid_assigns, #live_editing?, #locale, #locales, #merge_with_params, #next, #page, #params, #path, #repositories, #request, #services, #session, #site
Instance Method Details
#_call ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/locomotive/steam/middlewares/page_not_found.rb', line 16 def _call begin self.next rescue Locomotive::Steam::PageNotFoundException => e # fetch the 404 error page... env['steam.page'] = page_finder.find('404') # ... and render it instead render_page end end |