Skip to content

Fix/2.x/335 path alias#337

Merged
finnlewis merged 3 commits into
2.xfrom
fix/2.x/335-path-alias
Nov 4, 2025
Merged

Fix/2.x/335 path alias#337
finnlewis merged 3 commits into
2.xfrom
fix/2.x/335-path-alias

Conversation

@ekes

@ekes ekes commented Oct 29, 2025

Copy link
Copy Markdown
Member

What does this change?

Fixes prefixes (subdirectory, language) being included in parent path pattern for other instances.

See #335 (comment)

How to test

Set up site, or upgrade site, with multilingual and/or in a subdirectory. Create services, sub landing and pages. The paths should be correct and not repeat the language or subdirectory prefix to the path.

Present tests should continue to pass 🤞 if we want to test against this regressing then we'll have to start maybe adding multilingual tests (not such a bad idea).

@ekes

ekes commented Oct 29, 2025

Copy link
Copy Markdown
Member Author
  Problem 1
    - localgovdrupal/localgov is locked to version 3.x-dev and an update of this package was not requested.
    - localgovdrupal/localgov 3.x-dev requires localgovdrupal/localgov_services ^2.1.0 -> found localgovdrupal/localgov_services[2.1.0, ..., 2.x-dev] but it conflicts with your root composer.json require (dev-fix/2.x/335-path-alias as 1).

Ohhh... brain...

@finnlewis finnlewis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Brilliant, this works a treat!

New content is no longer created with the subdir in the path alias.

Existing pathauto patterns are updated with the update hooks.

We'll want some appropriate release notes to advise people who this affects to regenerate path aliases.

For example: drush pathauto:aliases-generate

@andybroomfield

Copy link
Copy Markdown
Contributor

@finnlewis Should it need to? won't the paths get updated on the next save of a page. The path alaises should be the same anyway (unless you have been running LGD in a sub directory).

@finnlewis

Copy link
Copy Markdown
Member

Fair point @andybroomfield, I guess it'd be an optional tidy up for those running in a sub-directory or on a language path.

@andybroomfield

Copy link
Copy Markdown
Contributor

Out of interest, would there be any Impact for those who have used this path pattern in other places. Assume making the same update is advised there too.

@tonypaulbarker

Copy link
Copy Markdown
Contributor

I have tested on two existing sites. I re-saved content and saw no issues. I ran a risky bulk regenerate via drush without running database updates and I saw some problems /housing/housing/council-housing .I ran a bulk regenerate with everything up to date and using the UI and saw no issues.
People should test these changes and bulk generation processes away from production.

I have not yet tested directories or step by steps.

@finnlewis finnlewis merged commit 96bd29b into 2.x Nov 4, 2025
17 checks passed
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.

4 participants