nystudio107 / craft-seomatic

SEOmatic facilitates modern SEO best practices & implementation for Craft CMS 3. It is a turnkey SEO system that is comprehensive, powerful, and flexible.
https://nystudio107.com/plugins/seomatic
Other
166 stars 71 forks source link

Accessing SEOmatic field values with reference tags #1541

Closed joepagan closed 1 week ago

joepagan commented 1 week ago

Hey, I'm not sure I've missed something on if this is supported?

Is your feature request related to a problem? Please describe.

A client wants to set data in one place for address info & opening hours. They wish to use this information inside of a rich-text field at times, it seems like using reference tags would be a good solution for this, if SEOmatic could support that? It would be great if other fields could also be supported, e.g. entity name, telephone, email, twitter handle etc

Describe the solution you would like

We would like to be able to use the address data stored in SEOmatic as the single source of truth where we can render the data inside a rich text with reference tags

Describe alternatives you have considered

A global would work, but then we have to keep the data updated in 2 places, or, extra work is required to overrule SEOmatic's address/opening hour field data

Thanks

khalwat commented 1 week ago

I'm not sure if Craft's reference tags would work for this, but you can try it. The data would be in:

{{ seomatic.site.identity.localBusinessOpeningHours }}
joepagan commented 4 days ago

Thanks for getting back, how would I access this data within a reference tag format? (I presume you didn't mean to directly try render the above twig variable but I can confirm that doesn't work in a rich text with single or double moustaches)

khalwat commented 4 days ago

Yeah I looked up how reference tags are decoded, and it's a big hairy regular expression, essentially. So I'm not sure it'll actually work, sadly.