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.
Problem/Motivation
Adding 'File' as a custom entity through the XML Sitemap configuration results in broken sitemap URL's.
Steps to reproduce
- Configure Custom Entity Settings at: admin/config/search/xmlsitemap/entities/settings
- Tick file, configure Sitemap Settings to be included, save changes
- Rebuild sitemap links: admin/config/search/xmlsitemap/rebuild
- Rebuild cron: admin/config/system/cron
- Navigate to YOUR_DOMAIN/sitemap.xml
- File links are broken
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#2 | broken_file_url-2820002-2.patch | 592 bytes | xiwar |
sitemap_xml.png | 642.48 KB | xiwar |
Issue fork xmlsitemap-2820002
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
xiwar CreditAttribution: xiwar at Redweb commentedI have attached a patch for this issue. This removes the duplicate host for file entities.
Comment #3
xiwar CreditAttribution: xiwar at Redweb commentedComment #5
jatinkumar1989 CreditAttribution: jatinkumar1989 commentedComment #6
jatinkumar1989 CreditAttribution: jatinkumar1989 commentedComment #7
Pranay Agarwal CreditAttribution: Pranay Agarwal commented#2 Thanks. Your solution is exactly what I was looking for.
Comment #8
Dave ReidI don't believe file entities should be includable in the sitemap without something like the File Entity module. If we do need this still I would prefer this code live in a file_xmlsitemap_link_alter() hook implementation that we add to xmlsitemap.module on behalf of the core file module.
Comment #10
ipo4ka704 CreditAttribution: ipo4ka704 at EPAM Systems commentedAs I see after this commit https://www.drupal.org/project/xmlsitemap/issues/3079398#comment-13681272 we can't include files entity type for xmlsitemap, so I think we can close this issue.
Comment #11
Dave ReidMarking as won't fix, agreed.