I started using the dato_meta_tags
helper. The title fallback functionality (item title field ➝ item SEO field title ➝ global SEO field title) is great, but once using this you somewhat lose the ability to create custom page titles. At the same time I don’t want to take out the helper and go back to totally custom page titles and metadata as SEO metadata override is a highly requested feature by my clients (they rarely provide a custom SEO title for an item, but when they do they really need it).
For example, you may want a product to be titled Product Category: Product Name — Site Suffix
. Product Name
would be the item’s title field, but how to add in Product Category
? Or perhaps you want an article page to be titled Article Author: Article Title — Site Suffix
. How to add the author?
I propose adding a ‘suggested title’ or similar option to the helper, which would be used unless the editor has specified a custom title by filling in an SEO field title field. It might look something like:
<% content_for(:head) do %>
<%= dato_meta_tags(article, suggested_title: "#{article.author}: #{article.title}") %>
<% end %>
The order of evaluation would be:
- Item SEO title field
- Helper suggested title
- Item title field
- Global SEO title field
What do you think? How are others managing custom title formats?