wordpress-seo icon indicating copy to clipboard operation
wordpress-seo copied to clipboard

Do not add duplicate images from a post to the sitemap

Open rmarcano opened this issue 7 years ago • 10 comments

Is your feature request related to a problem? Please describe.

When an image is added multiple times to a post, it's also added multiple times to the sitemap. For example, there might be some cases where users use an image as an introduction to a post, then it's used again further down in the content.

Describe the solution you'd like

I would like image entries not to be duplicated on the sitemap.

rmarcano avatar Jan 28 '19 13:01 rmarcano

Please inform the customer of conversation # 468350 when this conversation has been closed.

rmarcano avatar Jan 28 '19 13:01 rmarcano

Could you please provide a bit more context to this request?

  1. I created a new post
  2. added an image block and uploaded a new image
  3. added a paragraph block
  4. added a new image block and used the same image as in the first image block (from the media library)
  5. publish and check sitemap: no duplicate attachment entry.

This does happen when uploading the same image twice, but that is because the filename changes for the second upload attempt. So this is a expected behaviour.

Am I missing something? :)

Djennez avatar Jan 28 '19 14:01 Djennez

I am closing this thread due to inactivity.

Djennez avatar Feb 13 '19 15:02 Djennez

@Djennez Sorry for not replying earlier, I did not see the activity notification.

I've taken the same steps you mention and I'm able to reproduce the issue. When adding an image from the media library (without re-uploading it, but selecting it from the Media library), the image is added to the sitemap as many times as the image appears in the post:

Source code of the post: post-source

Image duplicates in sitemap source:

source

rmarcano avatar Feb 13 '19 16:02 rmarcano

Ah, I see, I am able to reproduce this :)

Pinging @jono-alderson at the request of @moorscode to see if this is something that we should do something with.

Djennez avatar Feb 18 '19 12:02 Djennez

Yep, this is a bug. Let's fix! :)

jonoalderson avatar Feb 18 '19 13:02 jonoalderson

It should be easy fix (I've already noticed this issue). We already have "filter" for gallery shortcode: array_unique( $attachments, SORT_REGULAR ); and similar "filter" should be added in method get_images.

stodorovic avatar Feb 18 '19 13:02 stodorovic

Just came across this bug myself (using the latest version of Yoast). The bug still exists. It has been almost 4 years since this issue was reported and confirmed. Will a fix for this ever make it into a release?

GoldenGoldy avatar Dec 13 '22 20:12 GoldenGoldy

still issue in 20.8 even you single times insert in pst still it double entry i think there some options require for sitemap to disable image in sitemap.

SimoyPala avatar Jun 02 '23 04:06 SimoyPala

Please inform the customer of conversation # 1183227 when this conversation has been closed.

amboutwe avatar Oct 16 '24 17:10 amboutwe