Multi-Part Posts with Nested Routing
- Published on
- Authors
- Name
- Terence Tian
- @hyperse_net
Nested Routes
The blog template supports organizing posts within nested sub-folders, ideal for grouping related content, such as a multi-part series. This post itself is an example, located in the /data/article/en/nested-route
folder.
How It Works
To create nested routes, simply organize your .md
/ .mdx
files in multiple sub-folders within the main /data/article directory
. For example, you can have /data/article/en/nested-route/deeply-nested-route/my-post.md
. Routing and path creation are managed using Next.js catch-all routes.
Use Cases
Here are some scenarios where nested routes are beneficial:
- Logical content organization: Posts are displayed by date but grouped logically.
- Multi-part series: Easily manage and navigate through related posts.
- Author-specific sub-routes: Organize posts by different authors.
- Internationalization: Although Next.js i18n might be better suited for this purpose. (we use
next-intl
)
Note
- The
previous/next
post links at the bottom are currently sorted by date. Consider modifying the template to link posts sequentially within a series.