djangocms-page-meta
djangocms-page-meta copied to clipboard
DefaultMetaImage: add text field for custom URL
Description
Add a field url
to the DefaultMetaImage
which is mutually exclusive to the filer field image
.
Use cases
We use DjangoCMS for building web shops. There is a logic which can derive the main product preview from the visited page. If the page is not a product page, our shop logo is considered as fallback. The derived image (main product preview or shop logo) is served as og:image
meta tag.
This is currently implemented and Django template tags in our own codebase but is not compatible with the "Default meta image" menu item our content team can (accidentally mis)use: If meta images are set at page level and if there is a default share image, our logic cannot properly distinguish through Meta.image
if it's set at page or global level. This leads to unintended behaviour about what is written into the og:image
meta tag.
Proposed solution
We would very much appreciate a new field url
to DefaultMetaImage
which is mutually exclusive to the image
filer field. It would be helpful if this is just a plain text field, as we could let our content team insert a placeholder, e.g. {{ default_share_image }}
. Our logic scrapes the rendered HTML payload and replaces this placeholder with either the product preview or shop logo URL. This would allow us to fulfill our use cases while having a solution fully compatible with djangocms-page-meta
.
Alternatives
We've implemented our own fallback solution. This led to conflicts and misunderstanding to implement this compatible with the current og:image
default image logic djangocms-page-meta
implements.
Please let me know if there are any questions or further explanations required. Thank you very much in advance.