Assigning Permalinks to Pages

Scrivito identifies every CMS object by its unique ID, a hexadecimal number that shows up in the address bar of the web browser, for example. For giving a page an identifier that's easier to remember, and for SEO purposes, you can assign an individual permalink to every non-binary CMS object, i.e. to every web page so that URLs look like this, for example: http://my.example.org/remember-me

For this purpose, CMS objects have a built-in attribute named _permalink. To make the permalink of a page editable in place, just render it in the details view of the page type concerned, like so:

<!-- app/views/content_page/details.html.erb -->

<%= scrivito_details_for 'Permalink' do %>
  <%= scrivito_tag :div, @obj, :_permalink %>
<% end %>

<%= scrivito_details_for 'Title' do %>
  <%= scrivito_tag :div, @obj, :title %>
<% end %>

<!-- ... -->

This causes the _permalink attribute to show up on the properties dialog of every page based on the “ContentPage” object class.

Permalinks need to be saved expicitly to validate them and thereby ensure the uniqueness of each of them.