Skip to content

Conversation

hxrshxz
Copy link

@hxrshxz hxrshxz commented Oct 11, 2025

Fixes #878

Description

Wikipedia and other external links were breaking with 404 errors due to Astro's trailingSlash: "always" config which was appending slashes to all URLs.

Changes

  • Modified middleware to remove traling slashes from external URLs (except root domains like https://example.com/)
  • Make sure that the middleware runs for all locales, including the default English local
Screencast.from.2025-10-11.23-03-24.mp4

@Copilot Copilot AI review requested due to automatic review settings October 11, 2025 17:19
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Fixes external URL 404 errors caused by Astro's trailingSlash: "always" configuration by removing trailing slashes from external URLs while ensuring the middleware processes all locales including the default English locale.

  • Refactored middleware to always process HTML links regardless of locale presence
  • Added logic to strip trailing slashes from external URLs while preserving root domain paths
  • Updated function signature to make currentLocale parameter optional

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Links to wikipedia are broken

1 participant