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

Make index suffix on URLs optional #442

Open
james-nash opened this issue Aug 10, 2023 · 0 comments
Open

Make index suffix on URLs optional #442

james-nash opened this issue Aug 10, 2023 · 0 comments

Comments

@james-nash
Copy link
Contributor

james-nash commented Aug 10, 2023

Currently, where a directory contains an index.mdx file, Mosaic will ensure that the corresponding URL ends in index. For example:

  • Source: foo/bar/index.mdx
  • URL: https://example.com/foo/bar/index

Requests to the URL https://example.com/foo/bar will be redirected to the corresponding https://example.com/foo/bar/index URL.

It would be nice if there was an option to change the behaviour so that it becomes:

  • Source: foo/bar/index.mdx
  • URL: https://example.com/foo/bar
  • https://example.com/foo/bar/index would be a permanent redirect to https://example.com/foo/bar

This is the behaviour we would like for the Salt site as:

  • We get more succinct URLs (easier to read, share verbally, guess, etc.)
  • It's more inline with how out-of-the-box Next.js behaves and indeed many other site generation tools where index.md|html|whatever files tend to be served up at URLs whose path omits the index part.

I suggest that this becomes an opt-in option though (perhaps via mosaic.config.js?), so that other Mosaic-based sites don't suddenly have all their URLs change upon upgrading.

Note that the non-index-suffixed URLs would also need to be reflected in any auto-generated links for site navigation, breadcrumbs, etc.

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

No branches or pull requests

1 participant