Generating Page Titles & Using Scrivito's Navigation

Generating Page Titles & Using Scrivito's Navigation

Page titles as HTML titles

To use the title of pages rendered by Scrivito or Solidus as the HTML title, adjust the #index method of the CmsController:

Now Solidus/Spree will use whatever title is set for the current Scrivito page. Please note that this change can only be observed if you are not logged in as an admin (e.g. in “private”/“incognito” mode).

Replacing Solidus' navigation with Scrivito's

First, create a Deface rule in /app/overrides/spree/shared/main_nav_bar.rb to replace the navigation of Solidus/Spree with a Scrivito partial.

Now create the partial that renders the main navigation:

Finally, remove the navigation from app/views/page/index.html.erb since the navigation is already rendered in the Solidus context. For this tutorial, remove the first <div>...</div> block from app/views/page/index.html.erb. Afterwards, the content of the file should be this:

Refresh your page and you will see that the Scrivito navigation bar is integrated with the Solidus style and editable.