You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a site full of blogs posts with url.com/blog-post-title.
When I work on local, and for the first fifteen minutes or so on an Atlas server, my blog posts correctly appear using the single.js template that I have mapped in my index.js in my wp-templates folder.
However, it seems to be that on revalidation, the blog posts end up using a dynamic routes template I have in my pages folder. That template is something like:
[category].js
and it uses getStaticPaths to generate paths I outlined in a separate doc. These paths just work, and I have a [category].js folder with templates inside that also seem to always work.
But...using a dynamic routes template seems to confuse the Faust router, but only on revalidate.
Steps to reproduce
Create a dynamic routs template in pages.
Create a single.js template in wp-templates and map it accordingly in the index.js.
Set the revalidate to 10:
export function getStaticProps(ctx) {
return getWordPressProps({ ctx, revalidate: 10 });
}
run npm build and start. see if after a few seconds your blog posts start to use the template from your dynamic route.
Additional context
No response
@faustwp/core Version
1.0.3
@faustwp/cli Version
1.0.1
FaustWP Plugin Version
1.2.1
WordPress Version
6.4.3
Additional environment details
I'm on Atlas.
Please confirm that you have searched existing issues in the repo.
Yes
The text was updated successfully, but these errors were encountered:
It seems that if you have both a dynamic route and a catch-all route in the same folder then Next.js will prioritize the dynamic route first and then the catch-all route.
import{useRouter}from'next/router';exportdefaultfunctionCategoryPage({data}){constrouter=useRouter();const{ category }=router.query;// Logic to fetch or display content based on the categoryreturn(<div><ahref="/blog/news">Back to News</a><h1>Category: {category}</h1><h1>Random Numbers:</h1><ul>{data.map((number)=>(<likey={number}>{number}</li>))}</ul></div>);}exportasyncfunctiongetStaticPaths(){return{paths: [],fallback: 'blocking',}}asyncfunctionfetchData(){constresponse=awaitfetch('https://www.randomnumberapi.com/api/v1.0/random?min=100&max=1000&count=5');// Replace with your API endpointconstdata=awaitresponse.json();returndata;}exportasyncfunctiongetStaticProps(){constdata=awaitfetchData();return{props: { data },revalidate: 10,// Revalidate every 10 seconds};}
Now even if my permalink structure is /%postname%/ it will still match the [category].js page.
When I visit a page like /blog/news it will match the catch all routes in [...wordpressNode].js.
Description
I have a site full of blogs posts with url.com/blog-post-title.
When I work on local, and for the first fifteen minutes or so on an Atlas server, my blog posts correctly appear using the single.js template that I have mapped in my index.js in my wp-templates folder.
However, it seems to be that on revalidation, the blog posts end up using a dynamic routes template I have in my pages folder. That template is something like:
[category].js
and it uses getStaticPaths to generate paths I outlined in a separate doc. These paths just work, and I have a [category].js folder with templates inside that also seem to always work.
But...using a dynamic routes template seems to confuse the Faust router, but only on revalidate.
Steps to reproduce
Create a dynamic routs template in pages.
Create a single.js template in wp-templates and map it accordingly in the index.js.
Set the revalidate to 10:
export function getStaticProps(ctx) {
return getWordPressProps({ ctx, revalidate: 10 });
}
run npm build and start. see if after a few seconds your blog posts start to use the template from your dynamic route.
Additional context
No response
@faustwp/core Version
1.0.3
@faustwp/cli Version
1.0.1
FaustWP Plugin Version
1.2.1
WordPress Version
6.4.3
Additional environment details
I'm on Atlas.
Please confirm that you have searched existing issues in the repo.
The text was updated successfully, but these errors were encountered: