Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gatsby,gatsby-adapter-netlify): support pathPrefix and trailingSlash options #38666

Merged
merged 34 commits into from Nov 13, 2023

Conversation

pieh
Copy link
Contributor

@pieh pieh commented Oct 25, 2023

Description

This adds support for pathPrefix and all trailingSlash options to gatsby-adapter-netlify.

On the adapter side:

  • report support for pathPrefix and all trailingSlash options
  • move built static files around before deploy so those static assets are routed to correctly (use Pretty URLs handling) - if expected route should be:
    • /prefix/page/ - then .html asset should be public/prefix/page/index.html
    • /prefix/page - then .html asset should be public/prefix/page.html
  • cache and restore .cache and public locally (gatsby doesn't handle file moves and it expects artificats in same place, so we cache state of public before we do file moves, so when we restore it on future build assets are in places expected by gatsby)

There are some adjustments on Gatsby side as well:

  • ensure paths in route manifest have the path prefix
  • make ssr lambda able to resolve pages correctly when pathname with prefix is used

Tests

e2e-adapters in this PR start running 2 variants:

  • (current) - no path prefix + default trailing slash (always)
  • (new) - path prefix + never trailing slash

Various assertions and test setup were adjusted so same tests can be used for both variants (they will adjust their assertions based on variant settings).

Additionally this unskips the e2e tests for trailing slash behavior (and we test both always and never variants)

Related Issues

FRA-65
FRA-23

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Oct 25, 2023
@pieh pieh added topic: adapters Related to Gatsby Adapters and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: adapters Related to Gatsby Adapters
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants