New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to fallback to a custom Opengraph image #8
Comments
Hi @esszett, I moved your question to a new issue to keep things organized a bit. That is very interesting, I actually didn't know about the feature to select a default value for the an image field. I think you are right, the fallback might only work when output formatting is on. I will look how to support this scenario. Or maybe you found it out already? :) In the meantime, you could rebuild this logic by hooking into the rendering process of the meta data. There are two hooks available, I am not sure which one is easier to use, see the test cases here: https://github.com/wanze/SeoMaestro/blob/master/tests/src/SeoMaestroTest.php#L83-L132 Cheers |
Hello @wanze, I didn't recognize the hookability… fantastico, that did it. Now I fetch the formatted output of the og_image field and processwire fetches the defined default values @field-settings. Thank you! My simple hook in ready.php
|
If the opengraph image is empty and references an existing image field using a default value, the image of the default page is now substituted for the opengraph image. See issue #8 for additional details.
@esszett FYI, the fallback to the default page image is now respected by the module in version |
Hi @wanze,
thank you …
The images fieldtype offers an option to fetch a default value (tab details) from a specific page if the field is empty. Since I have a global site settings page, I would like to fetch a default og_image from that settings page (in case the content page og_image-field is emtpy).
When I fetch $page->og_image on a content page, it returns the default image from the settings-page. The seo maestro output in header however contains no image tag.
I guess it's in your function getPageImage(), maybe it's related to the getUnformatted() call… that ignores the images-field options?
Originally posted by @esszett in #5 (comment)
The text was updated successfully, but these errors were encountered: