Gallery images part as Single Post Content for SEO purposes

Posted in: Newspaper
Post count: 48

Hi there, I was trying to make the images in my gallery to be part of the content for SEO purposes;

RankMath, for example, do not consider the gallery as part of my content and neither the Search Engines, and that is bad.

I had opened a ticket in the RankMath forum and that is what they said :https://support.rankmath.com/ticket/rankmath-is-not-counting-images-correctly-in-the-sitemap/

Then I tryed a code like this one in the Functions.php

//Gallery as content
function add_gallery_to_post_content($content) {
if (is_single('post') && in_the_loop() && is_main_query()) {
$gallery_shortcode = '[tdb_gallery id="2" class="Baixesoft_Gal" Gallery 2 tdb_gallery_2 POST/CPT gallery]';
$content .= do_shortcode($gallery_shortcode);
}
return $content;
}
add_filter('the_content', 'add_gallery_to_post_content', 10, 1);

This code generated by AI did not worked

Calin made a custom job in my website once…

I wonder if he can help me to make this work, so the images in the gallery can be consider part of my content for SEO purposes.

Thank’s!

Post count: 35449

Hi rafael-l,
I checked the discussion from RankMath forum and whet you need I’m not sure it is possible because the custom tagDiv gallery is not added inside the post content is outside of the post content, so to add gallery inside the post content those should be se inside article and you need to use the Gutenberg gallery or classic editor gallery.
Related to adding the tdb_gallery_2 in sitemap, maybe this can be done by a developer, but I it will not be easy.
Thank you for your understanding!

Post count: 48

Thank’s for your time and answer! I will figure something out.

Thank’s!

Viewing 3 posts - 1 through 3 (of 3 total)
The forum ‘Newspaper’ is closed to new topics and replies.