Tagged: gallery, Google, rich snippets
-
AuthorPosts
-
January 27, 2022 at 11:27 am #1337481
Hi,
we are using Enfold for an ecommerce plattform in combination with WooCommerce. Two days ago we got errors in the serch console.
Problems arise from a gallery that seems to be missing a parameter “url” or “contentUrl”. This was already a must have for videos but seems to be new for galleries?
See here for a direct link to an example of the issue: https://search.google.com/test/rich-results/result?id=7PMDJjsJ9w_TRPvUaCdwAAThanks for checking. Best regards Sascha
January 31, 2022 at 10:24 am #1338005Hey saschapi,
Thank you for the inquiry.
We can manually add the contentURL property to the avia-gallery container, but we have to directly edit the enfold/config-templatebuilder/avia-shortcodes/gallery/gallery.php. Around line 697, look for this code.
$output .= "<div {$meta['custom_el_id']} class='{$container_class} avia-gallery-" . self::$gallery . "' {$markup_gallery}>";
Below, add the meta element with the contentURL property and the post title as content value.
$title = get_the_title(get_the_ID()); $output .= "<meta itemprop='contentURL' content='{$title}'>{$title}</meta>";
Best regards,
IsmaelJanuary 31, 2022 at 10:34 am #1338006Thanks for this input. As this is disruptive (as it gets lost with every update), it should be included in the enfold core. It’s not breaking anything and will pop up more often, as the error in search console impacts more people.
I believe I cannot add this as a feature request, as the form is currently not available. Could you please forward it?
Thanks SaschaJanuary 31, 2022 at 11:24 am #1338024Hi,
Thank you for the update.
We will forward the modification to our channel for further consideration. For now, you will have to modify the shortcode file directly, or override it in the child theme. For more info on how to override a shortcode or builder elements, please check this documentation.
// https://kriesi.at/documentation/enfold/intro-to-layout-builder/#add-elements-to-alb
Best regards,
IsmaelFebruary 9, 2022 at 10:43 am #1339761Yes but should it be visible in the frontend? Look:
allthough i see in the gallery.php the meta end tag – it is not in the DOM – maybe that is the reason why the content is visible – because it is not inside the meta tag.
but:
“This element must not contain any content, and does not need a closing tag.”
Is it necessary to have here content?
i think it will be enough if that line is:$markup_meta = '<meta itemprop="contentURL" content="'. esc_attr( $post_title ) .'">';
Next: if we have here a itemprop=”contentURL” shouldn’t we have then a content=”url-whatever” ? and no title
$post_link = trim( get_the_permalink( get_the_ID() ) ); $markup_meta = '<meta itemprop="contentURL" content="' . esc_attr( $post_link ) . '" />';
February 10, 2022 at 7:55 am #1339910Hey!
Thank you for the observation @Guenni007. Yes, you are correct. We should use the URL as the content value, not the page title. We will adjust the changes in the next patch.
Cheers!
IsmaelFebruary 10, 2022 at 9:56 am #1339925Thanks – i have only adjusted the final version in my suggestion above, in case someone pulls out the fix here.
Can be closed
your link to your fix is here: https://pastebin.com/uDHPrFhJFebruary 11, 2022 at 8:52 am #1340091 -
AuthorPosts
- The topic ‘ContentUrl or url missing from rich snippets’ is closed to new replies.