How to create archive, category pages #174
-
I really liked this framework and i would like to use this one for my next project. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
@mehidi258 Glad you're liking it so far! We are working this week on properly supporting archive and category templates. We'll have a fix and updated documentation soon. For the time being, you could create a catch-all route under I'll update this issue when the fix for this is merged! |
Beta Was this translation helpful? Give feedback.
-
@trevanhetzel Thanks! |
Beta Was this translation helpful? Give feedback.
-
@mehidi258 #133 was merged in last week and our getting-started example now has more fleshed out examples of making custom queries and a category page example. There's also now a doc on fetching data with custom queries. |
Beta Was this translation helpful? Give feedback.
-
Awesome @trevanhetzel Really liked that and also thumbs up for the query part. |
Beta Was this translation helpful? Give feedback.
-
@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 If you would rather stick with the catch-all route, you'd need to use something like Hope that helps, but let me know if there are other specific custom page template questions! |
Beta Was this translation helpful? Give feedback.
@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 thepages
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…