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

The "page" prop in paginated dynamic routes doesn’t handle base URLs #10358

Open
1 task
amxmln opened this issue Mar 7, 2024 · 3 comments · May be fixed by #11253
Open
1 task

The "page" prop in paginated dynamic routes doesn’t handle base URLs #10358

amxmln opened this issue Mar 7, 2024 · 3 comments · May be fixed by #11253
Labels
- P2: nice to have Not breaking anything but nice to have (priority)

Comments

@amxmln
Copy link

amxmln commented Mar 7, 2024

Astro Info

Astro                    v4.4.13
Node                     v20.11.0
System                   macOS (arm64)
Package Manager          unknown
Output                   static
Adapter                  none
Integrations             astro-imagetools
                         @astrojs/vue

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When having a base option configured, the page prop resulting from having a dynamic route with paginated content doesn’t take that base into account.

This means that the URLs in page.url.prev and page.url.next are not prefixed with the configured base. This (strangely) doesn't cause issues in development mode, but when running a preview after build, the links don’t work correctly.

What's the expected result?

I believe page.url.prev and page.url.next should be correctly prefixed with base if it is defined in the configuration. If there are issues with that, the behaviour should at least be documented so developers can manually handle the case.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-kzsh3y?file=src%2Fpages%2Findex.astro

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Mar 7, 2024
@bluwy
Copy link
Member

bluwy commented Mar 8, 2024

I think it makes sense to add the base by default, but if we change it now, I feel like it would break many existing setups. Documenting it might be a good solution for now, and we can revisit this in Astro 5.

@matthewp matthewp assigned matthewp and unassigned matthewp Mar 8, 2024
@matthewp
Copy link
Contributor

matthewp commented Mar 8, 2024

I don't quite understand, what API is this in reference to? What is page.url.next? Can you link to docs on this API?

@bluwy
Copy link
Member

bluwy commented Mar 8, 2024

It's https://docs.astro.build/en/reference/api-reference/#pageurlprev. Currently paginate() generates it, but it doesn't have knowledge of the current base IIUC.

@Princesseuh Princesseuh added - P2: nice to have Not breaking anything but nice to have (priority) and removed needs triage Issue needs to be triaged labels Mar 18, 2024
@kevinzunigacuellar kevinzunigacuellar linked a pull request Jun 14, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P2: nice to have Not breaking anything but nice to have (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants