Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello everyone, how are you?
First of all; congrats on the project. It's very useful.
Problem/Motivation
Question; Does Simple XML Sitemap not have support for Paragraphs?
https://www.drupal.org/project/paragraphs
In our case, there are many Nodes with Paragraphs and inside of these Paragraphs, there are images and PDFs. But simple_sitemap isn't indexing it.
There is a possibility to index these Paragraphs with Images/PDFs?
Thanks in advanced
Comment | File | Size | Author |
---|---|---|---|
#25 | 315296-25.patch | 2.84 KB | Manuel Garcia |
#23 | support_for_paragraphs_4_1_2.patch | 2.38 KB | InaW |
#21 | support-for-paragraphs-3152961-21.patch | 2.67 KB | WalkingDexter |
Comments
Comment #2
renatogComment #3
renatogComment #4
renatogComment #5
renatogComment #6
renatogComment #7
renatogComment #8
renatogComment #9
renatogComment #10
renatogComment #11
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commentedAs paragraphs are parts of a single page for a SEO sitemap you would not want to index the paragraph itself and you should be fine with indexing the actual webpage.
Images/pdfs could profit somewhat from being explicitely indexed in a sitemap, but there is no built in support for images inside of media or paragraphs yet. For media you might want to look at #2987748: Add Media images to sitemap.
However IMO if you are indexing the page the images/pdf's are at, google will pick those up.
Comment #12
renatogYeah, the idea isn't to index the paragraph. The idea is to index the page with images and pdf's (uploaded in Paragraphs)
So, for example, there is a page
/node/7
and inside of this node there is a paragraph, and inside of this paragraph, there is an image and one PDF.The sitemap.xml was generated with
/node/7
indexed, but without image and without PDF (because they're inside of paragraph)Well, thank you so much for your help. It's just a double check to check if there is a solution to files inside of Paragraphs.
Thanks a lot @gbyteco
Comment #13
felribeiro CreditAttribution: felribeiro at CI&T for Johnson & Johnson commentedComment #14
renatogI was reviewed by our team and really works well!
Thank you so much @felribeiro
Have a good weekend
Comment #15
renatogAdding a small verification to check if paragraph was loaded
Comment #16
renatogComment #17
Berdiruse foreach ($entity->get($field->getName() as $item) and then $item->entity, no need to hardcode paragraphs.
I wouldn't pass in $field though but just the field name. The type hint is wrong anyway, this would fail hard if it's a base field.
That said, it might be better to optionally support the entity_usage project, you could just ask its APi to get all references of a certain type. Then you'd also support media entities for example.
Comment #18
renatogHello @berdir how are you?
Thank you so much for your feedback but sorry I didn't understand your points.
Could you try to explain using a different way, please?
Comment #19
edsoncarlos CreditAttribution: edsoncarlos at CI&T for Johnson & Johnson commentedComment #20
VasiliyRepin CreditAttribution: VasiliyRepin as a volunteer commented4.x patch
Comment #21
WalkingDexter CreditAttribution: WalkingDexter as a volunteer and at Initlab commentedA fresh look at the issue.
Comment #22
WalkingDexter CreditAttribution: WalkingDexter as a volunteer and at Initlab commentedMain points:
ParagraphInterface
, not by the field type. This works even if the "paragraphs" module is not enabled or if it's missing from the codebase (because that's how PHP works).@gbyte Your opinion is important here (as the module creator).
Comment #23
InaW CreditAttribution: InaW at Unic commentedReupload Patch for simple_sitemap version 4.1.2
Comment #25
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and commentedFirst, thanks all for the patch, I have been evaluating it and seems to work as advertised.
I had to reroll it so I am attaching the re-roll which should apply cleanly against
4.x
.De-assigning assuming this is no longer being worked by
gbyte
:)Comment #26
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commented@ManuelGarcia @WalkingDexter So sorry, this slipped my mind. Will make a todo and look at it in October! Anyone feel free to look at the code and add your opinions!
Comment #28
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commented@WalkingDexter This is really neat, sorry I missed your contribution.
Comment #29
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commentedComment #30
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commented@WalkingDexter I commited last night without giving you author attribution - is there a way to fix that?
Comment #31
WalkingDexter CreditAttribution: WalkingDexter as a volunteer and at Initlab commented@gbyte I don't think this is possible since the commit is already done. Don't worry, my contribution is already listed in the Git message.