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

Can someone add more documentation on routes.json ? #2

Closed
PrimozRome opened this issue Aug 18, 2021 · 3 comments
Closed

Can someone add more documentation on routes.json ? #2

PrimozRome opened this issue Aug 18, 2021 · 3 comments

Comments

@PrimozRome
Copy link

I am having hard time understanding these and how to define route? Is there anyone that can help me?

  1. Define your routes

In the pages folder, and in each of its subfolders, add a routes.json file with the following:

// `/pages/section/routes.json`
{
  "/": {
    "es": "seccion" // Folder path in es
  },
  "page1": {
    "default": "article", // Overwrite the default page path (fallback)
    "es": "articulo"
  },
  "page2": "definition", // Overwrite the page path for all language
}

The "/" section define the folder paths, each other section define the paths of a page file in this folder.

@michalpulpan
Copy link
Contributor

Hi, did you manage to resolve it. Or more - to use this plugin somehow efficiently?

I now have folder structure like so:

/pages/
|-subfolder1/
|--index.tsx
|-subfolder2/
|--[id]/
|---something
|----index.tsx

would you still put "routes.json" into each subfolder?
So let's say into "subfolder2" it'd contain
/pages/subfolder2/routes.json

"[id]":{
   "en": "[id]",
    ...
}

and
/pages/subfolder2/[id]/routes.json

"something":{
   "en": "something",
    ...
}

@cvolant
Copy link
Collaborator

cvolant commented Nov 25, 2021

There is no need to add a routes.json file if you don't want to customize the routes in this subfolder.
I updated the readme: I hope it is clearer now.

@cvolant
Copy link
Collaborator

cvolant commented Nov 25, 2021

Let me know if it is not clear enough: I can reopen this issue.

@cvolant cvolant closed this as completed Nov 25, 2021
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

3 participants