I am using SEOmatic on Craft 2 and want to give the user the ability to customize the Title field of Facebook's OpenGraph Title. For example, instead of showing just the Title, add a "How To" before the title is displayed. Article title only

vs. enter image description here

Is there a way to do this without using a custom field and have the "How To" only display only on when the article is shared on Facebook?

1 Answer 1


Referring to this page, you can try this:

{% set og = seomaticMeta.og %}
{% set og = og | merge({'title': 'How to: ' ~ seomaticMeta.og.title}) %}
{% set seomaticMeta = seomaticMeta | merge({'og': og}) %}
  • I checked this out but my concern is that it would add "how-to" to all of the open graphs for the entries site. I don't want the og for other parts of the website to saw "How To'. Is there a way to test something like : if entry equals article then set og this way, if not set it another way? Or is that crazy talk.
    – Lily K
    Commented Apr 20, 2018 at 16:26
  • 1
    You have 2 options: 1. You can create special template for How-To articles and add this code only into this template 2. You can add a How-to lightswitch field in the control panel, then check in the template if it is true and add the code above. Commented Apr 23, 2018 at 8:46
  • Thank you for this suggestion! I'll let you know once I've implemented it.
    – Lily K
    Commented May 4, 2018 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.