Skip to content

Conversation

@jorrit
Copy link
Contributor

@jorrit jorrit commented Jul 4, 2025

What does it do?

Adds an option to generate unique urls per locale instead of across the entire site.

Why is it needed?

When the locale is already part of the URL (for instance, in the domain name or an externally provided path prefix) the URL does not need to be unique for the site, but just for the locale.

How to test it?

  1. Create Strapi content with multiple locales but the same value for the fields in the placeholder(s).
  2. Create URL patterns for these locales that are identical for the locales
  3. Set the new config option unique_per_locale to true.

Related issue(s)/PR(s)

Addresses #289

@changeset-bot
Copy link

changeset-bot bot commented Jul 4, 2025

🦋 Changeset detected

Latest commit: 1892da5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
strapi-plugin-webtools Minor
docs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link

codecov bot commented Jul 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 40.98%. Comparing base (c098a92) to head (1892da5).
Report is 10 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #291      +/-   ##
==========================================
- Coverage   43.10%   40.98%   -2.12%     
==========================================
  Files           2        2              
  Lines         638      627      -11     
  Branches      157      153       -4     
==========================================
- Hits          275      257      -18     
- Misses        291      296       +5     
- Partials       72       74       +2     
Flag Coverage Δ
unit 40.98% <100.00%> (-2.12%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@boazpoolman boazpoolman self-assigned this Jul 4, 2025
@boazpoolman boazpoolman self-requested a review July 5, 2025 10:34
@boazpoolman boazpoolman assigned jorrit and unassigned boazpoolman Jul 5, 2025
Copy link
Member

@boazpoolman boazpoolman left a comment

Choose a reason for hiding this comment

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

Hi @jorrit,

Thanks for this PR. This looks like a well documented and tested feature that will be a great addition to the plugin!

I've review your work and at first glance it looks to be perfectly in order. One thing I did notice is there is one test case that isn't working as expected, which is the following:

This PR, without putting unique_per_locale on true, allows duplicate URLs across different translations of the same document. This is unexpected behavior. In this case it should suffix the URLs with -0. I've written a test case for this specific situation which should be failing now. Could you address that?

Other than that it seems to be working great!

@jorrit jorrit force-pushed the uniqueurlperlocale branch from b96c8ba to 97668a8 Compare July 7, 2025 07:10
Copy link
Member

@boazpoolman boazpoolman left a comment

Choose a reason for hiding this comment

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

LGTM!

@boazpoolman boazpoolman merged commit 272a9ae into pluginpal:master Jul 7, 2025
7 of 8 checks passed
@pluginpal-bot pluginpal-bot mentioned this pull request Jul 7, 2025
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.

2 participants