Skip to content

The sitemap.xml requires absolute URLs in <loc> tags#3753

Merged
tvdeyen merged 1 commit intoAlchemyCMS:mainfrom
foureb:fix-sitemap
Mar 16, 2026
Merged

The sitemap.xml requires absolute URLs in <loc> tags#3753
tvdeyen merged 1 commit intoAlchemyCMS:mainfrom
foureb:fix-sitemap

Conversation

@antwertinger
Copy link
Copy Markdown
Contributor

What is this pull request for?

show_alchemy_page_url was returning only a path (e.g. /) instead of an absolute URL (e.g. https://www.example.com/). The sitemap protocol requires absolute URLs in tags — relative paths cause the sitemap to be invalid.

The root cause: url_for with a string argument returns the string as-is in Rails and does not prepend protocol or host. Fixed by using request.base_url to build the absolute URL.

Notable changes (remove if none)

show_alchemy_page_url now correctly returns an absolute URL including protocol and host. Specs updated accordingly.

Checklist

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change

…protocol. url_for with a string path returns the path as-is, so use request.base_url to prepend protocol and host.
@antwertinger antwertinger requested a review from a team as a code owner March 16, 2026 16:23
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.46%. Comparing base (93033dc) to head (3829a4c).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3753   +/-   ##
=======================================
  Coverage   97.46%   97.46%           
=======================================
  Files         317      317           
  Lines        8431     8431           
=======================================
  Hits         8217     8217           
  Misses        214      214           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tvdeyen tvdeyen added this to the 8.2 milestone Mar 16, 2026
@tvdeyen tvdeyen merged commit ab0affd into AlchemyCMS:main Mar 16, 2026
27 checks passed
@tvdeyen tvdeyen added the bug label Mar 20, 2026
@alchemycms-bot alchemycms-bot bot mentioned this pull request Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants