Tagged: Image sitemap
-
AuthorPosts
-
January 16, 2019 at 12:16 pm #1054532
Hello, ich habe schon in einem Thread 2017 angemerkt, dass die images via Yoast Sitemap nicht korrekt indiziert werden.
Konkret habe ich drei portfolio Einträge die jeweils mehrer Images enthalten aber in der Sitemap nur wenige Images angeführt werden.
Was kann ich tun, damit die Images alle in der Sitemap enthalten sind?
Beste Grüße, Michael
January 19, 2019 at 5:46 pm #1055912Hey fragezeichen,
Entschuldigung für die späte Antwort, meine Forschung zeigt, dass die Yoast-Sitemap Probleme beim Lesen des Shortcodes für den erweiterten Layoutersteller hat. @ismael hat an einer Funktion gearbeitet, die Yoast beim Lesen der Bilder hilft, please see this post
Es wurde berichtet, dass es von anderen Benutzern funktioniert.Weitere Informationen zu Yoast-Sitemaps
und über Bilder und die Sitemap— Translated with Google —
Sorry for the late reply, my research shows that the Yoast sitemap has trouble reading the advanced layout builder shortcode, @ismael has worked on a function that helps Yoast read the images, please see this post.
It has been reported as working by other users.Here is some more info about Yoast sitemaps
and about images and the sitemapBest regards,
MikeJanuary 21, 2019 at 4:52 pm #1056783Hello Mike,
since the code was postet 2017, I am wondering if its not part of the actual Enfold version?
In the thread some minor changes are mentionend and I am not sure where to put the code.
Is it possible for you or your team to either put the code in the next enfold version or to create a easy tutorial?I think it would be easier for all those people like me, who have no coding background and are afraid of messing up the whole system.
Regards, Michael
January 23, 2019 at 1:46 am #1057523Hi,
There not seem to be any changes – u can always go ahead and do those changes and let us know if we have to help anything else.
Best regards,
BasilisJanuary 25, 2019 at 7:20 pm #1058880Hi,
after update of functions.php with the code you´ve sent me – what steps do I need to take to re-generate the sitemap?
Regdards,
Michael
January 26, 2019 at 5:00 pm #1059171Hi,
You will only need to reload the site map, that is refresh the page: /sitemap_index.xml
Here are some before and after screenshots of my localhost sitemap:
Before:
After:
This is the code I added to the end of my child theme functions.php file in Appearance > Editor://add image to site maps function avia_extract_shortcode($elements, $content) { $container = array(); if(!empty($elements)) { foreach ($elements as $key => $element) { preg_match_all($element['pattern'], $content, $shortcodes); foreach($shortcodes[0] as $shortcode) { switch ($element['source']) { case 'ids': $src = '/ids=\\\'(\d+(,\d+)*)\\\'/'; break; case 'src': $src = '/attachment=\\\'(\d+)\\\'/'; break; case 'sid': $src = '/id=\\\'(\d+)\\\'/sim'; break; default: return; } $sid = array(); preg_match_all($src, $shortcode, $id); if($src = 'sid') { foreach($id[1] as $key => $value) { $sid[] = $value; } $sid = implode(',', $sid); $id[1] = $sid; } $container[] = $id[1]; } } } if(!empty($container)) { foreach($container as $key => $value) { $container[$key] = explode(',', $value); } } if (count($container) > 0) { $container = call_user_func_array('array_merge', $container); } return $container; } function avia_filter_wpseo_sitemap_urlimages($images, $post_id) { $post = get_post($post_id); if (is_object($post)) { $content = $post->post_content; $elements = apply_filters('avf_add_elements_wpseo_sitemap', array( 'masonry' => array( 'pattern' => '/\[av_masonry_gallery [^]]*]/', 'source' => 'ids' ), 'gallery' => array( 'pattern' => '/\[av_gallery [^]]*]/', 'source' => 'ids' ), 'horizontal' => array( 'pattern' => '/\[av_horizontal_gallery [^]]*]/', 'source' => 'ids' ) ), $elements, $post_id); $ids = avia_extract_shortcode($elements, $content); foreach ($ids as $id) { $title = get_the_title($id); $alt = get_post_meta($id, '_wp_attachment_image_alt', true); $src = wp_get_attachment_url($id); $images[] = array('src' => $src, 'title' => $title, 'alt' => $alt); } } return $images; } add_filter('wpseo_sitemap_urlimages', 'avia_filter_wpseo_sitemap_urlimages', 10, 2); add_filter('avf_add_elements_wpseo_sitemap', function($elements, $postid) { $image = array( 'image' => array( 'pattern' => '/\[av_image [^]]*]/', 'source' => 'src' ), 'accordion' => array( 'pattern' => '/\[av_slideshow_accordion(.+?)?\](?:(.+?)?\[\/av_slideshow_accordion\])?/sim', 'source' => 'sid' ), 'slideshow' => array( 'pattern' => '/\[av_slideshow(.+?)?\](?:(.+?)?\[\/av_slideshow\])?/sim', 'source' => 'sid' ), 'slideshow_full' => array( 'pattern' => '/\[av_slideshow_full(.+?)?\](?:(.+?)?\[\/av_slideshow_full\])?/sim', 'source' => 'sid' ), 'slideshow_fullscreen' => array( 'pattern' => '/\[av_fullscreen(.+?)?\](?:(.+?)?\[\/av_fullscreen\])?/sim', 'source' => 'sid' ) ); return array_merge($image, $elements); }, 10, 2);
Best regards,
MikeJanuary 28, 2019 at 9:46 am #1059557Hello Mike,
thank you for your help!
I´ve inserted the code into my child theme.
Now my sitemap looks much better and contains more Images.
Thank you very much and regards,
Michael
January 28, 2019 at 2:23 pm #1059632Hi,
Glad we could help, I assume we can close this now, but I like to ask first.
Is there anything else we can assist with on this issue?Best regards,
MikeJanuary 28, 2019 at 2:45 pm #1059645Thanks, we can close this threat.
Regards, Michael
January 28, 2019 at 6:00 pm #1059725Hi,
If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘Image Sitemap Problem’ is closed to new replies.