Skip to content

How to create archive, category pages #174

Answered by trevanhetzel
mehidi258 asked this question in Q&A
Discussion options

You must be logged in to vote

@mehidi258 If you're using a WP theme that has a custom page template, templating in our framework works just like any other page type, following the WP template hierarchy. For instance, it will look for the ID, then slug, then a custom template.

If you're looking to render a template in Next.js based on a route, you can do that by simply creating a .tsx file in the pages directory with the name of the route. This will get hit instead of the [[...page]].tsx catch-all.

If you would rather stick with the catch-all route, you'd need to use something like useRouter and render your custom template inside a conditional that matches the current route.

Hope that helps, but let me know if there ar…

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by josephfusco
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #127 on March 03, 2021 16:46.