Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

used generateStaticParams to build blog pages for SEO Optimization #7

Closed

Conversation

mustafahoda
Copy link

@mustafahoda mustafahoda commented Aug 31, 2024

stumbled upon the Wisp CMS and used it on my own blog. One addition I did was build the Blog Pages at build time instead of request time and wanted to contribute the same strategy here if the community finds it beneficial. Provides a few benefits:

  • Inline with Next.js best-practices (using Server Components where possible)
  • Generates Static Pages
  • Better for SEO (your blog pages can now be indexed)
  • removes the building of blog pages at request time

Before:

Screenshot 2024-08-31 at 12 29 10 PM

After:

Screenshot 2024-08-31 at 12 28 26 PM

Copy link

vercel bot commented Aug 31, 2024

@mustafahoda is attempting to deploy a commit to the Wisp CMS Team on Vercel.

A member of the Team first needs to authorize it.

@yehjxraymond
Copy link
Contributor

Hey @mustafahoda, thanks for the PR and the detailed writeup. I really appreciate this.

Your approach indeed will make the page load much faster as they are created during build. An issue arises when new blog posts are added after the code is built, that is the page would not have been generated and will require to be generate on run-time anyway.

The effect of this approach is that parts of the pages will be static and parts after the build will be dynamic. I'm undecided if this should be the default settings since the current approach uses vercel's cache too (which honestly can be configured too).

What I can do is to file this into a documentation somewhere on optimising SEO so that people can choose if they want a large part of their site to be statically generated.

@mustafahoda
Copy link
Author

Hi @yehjxraymond ,

Yup! I thought of this problem as well: how do we handle creation of new Blog Posts and then having those built to generated server side to ensure we're making most of the optimzations Next.js offers. I see a few options:

  1. Rebuild using Vercel Deploy Hooks. This is what I do when I publish a new post. Make a request to the deploy hook and the build happens again.
  • ideally Wisp CMS has a webhook and we can point it to our deploy hook.
  • This will however increase build time for large sites that have a lot of pages to build.
  1. We can use an Incremental Static Regeneration Strategy to generate the initial N number of blogs. And then create the rest during run-time.
  • consider using dynamicParams. Build only the first N pages, and then the rest can be done at build time.

Great project! Let me know what you're thinking and would be most happy to contribute :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants