Does NextJS ISR also run in client while crawlers indexing the page?

66 Views Asked by At

So, I have built a website similiar to a blog. It gets the posts in getStaticProps. I know ISR is a good choice for SEO, especially NextJS itself. But the thing is, I have a filter for the website which works with queries like this: localhost:3000/articles/?sort=most-read So basically when page is loaded or path is changes, I need to check if there is sort query in the route. That's why I need to use useRouter()

    if(router.query.sort === "most-read") {
        setShownPosts(fetchData(`http://127.0.0.1:8000/${router.locale === "en" ? "en/" : ""}api/articles/?ordering=-reads`))
    } else if(router.query.sort === "old-posts") {
        setShownPosts(fetchData(`http://127.0.0.1:8000/${router.locale === "en" ? "en/" : ""}api/articles/?ordering=created_at`))
    } else {
        setShownPosts(posts);
    }

Then I show the posts in JSX part:

{shownPosts?.results.map((post, index) => (
    <Post key={index} info={post} />
))}

Problem is that I know useRouter() does not work in getStaticProps that's why I am worried if it would affect the SEO perfomance.

If it would, what would you suggest? Help very much appreciated :)

0

There are 0 best solutions below