“Suggested Title” Option for Meta Tags Helper

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?

A related issue I’m having with dato_meta_tags is that an item with an empty SEO description field falls straight back to the Global SEO value. This is bad as it leads to lots of pages with duplicate meta descriptions. Making the SEO description field required isn’t a good option either, as often it’s duplicating another summary or description field, and I really don’t want to train my users to enter duplicate content — they do plenty of that anyway!

A good solution for this could be to add a description field alongside the title field under a model’s additional settings. This would allow you to use, for example, a lede or summary field on an article as the fallback description. Even if the field chosen is too long, a truncated meta description is better than a duplicate. (And that’s no different to an item’s title field being too long).