Method: Scrivito::Configuration.choose_homepage

Defined in:
lib/scrivito/configuration.rb

.choose_homepage { ... } ⇒ Object

A callback that can be provided for determining the CMS object to be used when visiting the homepage. See scrivito_route for details on how to define routes. The callback is called once per request and receives the rack environment as its only parameter. By default, the CMS object at the root path (/) is used as the homepage.

Examples:

Scrivito.configure do |config|
  config.choose_homepage do |env|
    Obj.root # Replace with code to set the homepage
  end
end

Yields:

  • Rack environment of the current request



316
317
318
# File 'lib/scrivito/configuration.rb', line 316

def choose_homepage(&block)
  self.choose_homepage_callback = block
end