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

Dynamic pages without index.js not translating trough translatePath #36

Closed
draxx318 opened this issue Aug 2, 2022 · 1 comment
Closed

Comments

@draxx318
Copy link

draxx318 commented Aug 2, 2022

Example folder structure:

pages(folder)
       destinations(folder)
              [id].js

_routes.json looks like this:

{
    "/": {
        "en": "destinations",
        "hr": "destinationsHr",
        "de": "destinationsDe"
    }
}

translatePath usage:
translatepath('/destinations', 'de')

In this case, translatePath returns the original page name instead of the translation. This only happens to dynamic routes without an index.js page.

Edit:
On folder structure with catch all routes works flawlessly.

pages(folder)
       destinations(folder)
              [[...id]].js
@cvolant
Copy link
Collaborator

cvolant commented Aug 17, 2022

Yes, in the first config, there is not any page file matching the /destinations path. You could also add an pages/destinations/index. js file.

@cvolant cvolant closed this as completed Aug 17, 2022
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

2 participants