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
renatog commentedComment #3
renatog commentedComment #4
renatog commentedComment #5
renatog commentedComment #6
renatog commentedComment #7
renatog commentedComment #8
renatog commentedComment #9
renatog commentedComment #10
renatog commentedComment #11
gbyteAs 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
renatog commentedYeah, 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/7and 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/7indexed, 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 commentedComment #14
renatog commentedI was reviewed by our team and really works well!
Thank you so much @felribeiro
Have a good weekend
Comment #15
renatog commentedAdding a small verification to check if paragraph was loaded
Comment #16
renatog commentedComment #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
renatog commentedHello @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 commentedComment #20
vasiliyrepin commented4.x patch
Comment #21
walkingdexter commentedA fresh look at the issue.
Comment #22
walkingdexter 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 commentedReupload Patch for simple_sitemap version 4.1.2
Comment #25
manuel garcia 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@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@WalkingDexter This is really neat, sorry I missed your contribution.
Comment #29
gbyteComment #30
gbyte@WalkingDexter I commited last night without giving you author attribution - is there a way to fix that?
Comment #31
walkingdexter 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.