SEO meta tags

Is there a reason that og:title and twitter:title do not append the defined global suffix like standard <title> meta tag? I would want it append there as wellā€¦

     "_seoMetaTags": [
        {
          "attributes": null,
          "content": "Test and Measurement Solutions | Dewesoft",
          "tag": "title"
        },
        {
          "attributes": {
            "property": "og:title",
            "content": "Test and Measurement Solutions"
          },
          "content": null,
          "tag": "meta"
        },
        {
          "attributes": {
            "name": "twitter:title",
            "content": "Test and Measurement Solutions"
          },
          "content": null,
          "tag": "meta"
        },

Hello @primoz.rome

It would indeed make sense to add the suffix to those two parameters as well.
Iā€™ve opened a request to do so, and iā€™ll get back to you :slight_smile:

@primoz.rome the idea here was that the suffix is useful for SEO purposes, it might be annoying on the social cards?

@mat_jack1 hmm I havenā€™t think of that. We are using it also on social cards.
Maybe adding a checkbox ā€œUse it on the social cardsā€ would be an all-flexible solution?

Thanks,
Primoz

Sorry, i missed your response!

Canā€™t you do that on the frontend already?

@mat_jack1 what do you mean exactly?

When you are generating the HTML for the social cards you can do something different compared to what you do for SEO purposes, or am I missing something?

@mat_jack1 but the HTML for social cards is generated by the renderMetaTags method of your react-datocms package.

Sure I could do that myself on the front end, but I like how renderMetaTags takes care of that automatically.

right! OK, weā€™ll discuss if we want to add something on our component, thank you for the suggestion!

1 Like

Heya, just spent some time debugging this as it came in from a Content Author wondering why the title suffix from the preferences isnā€™t rendering. Having to go back to the client and let them know itā€™s a limitation of DatoCMS and we will have to charge to add this as a bespoke option on quite a large website.

In the end we found the quickest solution was to pass _seoMetaTags to a function like this as it seems it does have the title with suffix as the first entry in the array;

function normaliseMetaTitles(metaTags) {

  const titleWithSuffix = metaTags[0]?.content;
  if (!titleWithSuffix) return metaTags;

  // OG Title and Twitter title array locations;
  const indices = [1, 2]; 

  return metaTags.map((tag, index) => {
    if (indices.includes(index) && tag?.attributes) {
      return {
        ...tag,
        attributes: {
          ...tag.attributes,
          content: titleWithSuffix,
        },
      };
    }
    return tag;
  });
}

It would be a lot nicer if this was an option, and was mentioned in the docs for the function. Cheers! :raised_hands:

Sorry, Iā€™m coming into this late, and trying to understand the use cases here.

A social card would look something like this, right (from the Twitter example)?

Is the ask here to make the title say ā€œDeath Valley Wilderness : Wilderness Light | YouTube.comā€, even though youtube.com is already on its own line?

Or for Facebook:
Screenshot 000719

Youā€™d want that to say ā€œWhen Great Minds Donā€™t Think Alike | The New York Timesā€ even though itā€™s also in the business page name?

It feels redundant to me, so I just wanted to make weā€™re understanding the use case here?

(Edit: Iā€™ve updated the docs to be clearer in the meantime, but if we end up changing the behavior here, I will update the docs again.)