Skip to content

Conversation

@jesseleite
Copy link
Contributor

@jesseleite jesseleite commented Jun 27, 2025

This PR adds config to enforce trailing slashes on urls and links during SSG generation. This is useful for things like SEO sitemap, RSS feeds, etc. on server hosts that bias towards trailing slashes (ie. Netlify expects trailing slashes for SEO).

Todo

  • Add opt-in config
  • Wire up config to enforce trailing slashes on ssg:generate only
    • We don't want this always running in the service provider!
  • Flesh out test coverage

References #65
References statamic/cms#11840

duncanmcclean and others added 9 commits May 1, 2025 10:45
We can change this to `^6.0` when an alpha/beta is tagged.
* Remove Testbench 8 from composer.json

* Remove PHPUnit 10

* Remove Laravel 10 and PHP 8.1 from testing matrix
* Take the "display timezone" into account when setting Carbon string format

* Use `Statamic::displayTimezone()`
@jesseleite jesseleite marked this pull request as ready for review July 18, 2025 17:07
@jesseleite jesseleite changed the base branch from master to statamic-v6-support July 18, 2025 17:07
@jesseleite jesseleite merged commit e52a9ef into statamic-v6-support Jul 18, 2025
29 checks passed
@jesseleite jesseleite deleted the enforce-trailing-slashes branch July 18, 2025 17:07
duncanmcclean added a commit that referenced this pull request Sep 22, 2025
* Require statamic/cms dev-master for now

We can change this to `^6.0` when an alpha/beta is tagged.

* [4.x] Drop Laravel 10 Support (#200)

* Remove Testbench 8 from composer.json

* Remove PHPUnit 10

* Remove Laravel 10 and PHP 8.1 from testing matrix

* Remove toStringFormat handling for Carbon 2 (#201)

* [4.x] Improved Timezone Handling (#197)

* Take the "display timezone" into account when setting Carbon string format

* Use `Statamic::displayTimezone()`

* Add config to enforce trailing slashes during generation.

* Fix for 404 not generating.

* Assemble absolute URL instead.

* Fix `is404()` logic for hardcoded 404.html destination.

* Handle config (tests still wip).

* Add basic test coverage for generated URLs.

* Add test coverage for our 404 fix.

* Remove experimental note. We can just fix bugs as they're reported.

* Temporary composer constraint until we tag Statamic v6.

---------

Co-authored-by: Duncan McClean <duncan@duncanmcclean.com>
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.

3 participants