Static SEO on ICP Websites

Is there any SSG (static site generation) framework for Rust ICP http canisters? For example, pre-generating 100 html files for 100 blog posts, storing them in canister or 3rd party storage, and serving to google for indexing.

Would developers just handle it normally with existing rust ssg frameworks like Shokunin Crate? Any compatibility issues in an ICP wasm environment?

I guess the best way to find out is to try it, but I didn’t see any threads in forum search about this topic so figured it would be good to start one. (searching forum for “SEO” gets a lot of noise).

1 Like

You can use nextjs, relatively easy and simple to pre-render the html. The prerendered html files for the blogs will be stored on the frontend canister. Just make sure they are available in your backend at build time and apply the relevant logic to fetch them during building.

1 Like

NextJS works! In theory that would require the JS server being offchain, and uploading the generated html to the asset canister. This works fine pragmatically.

Out of curiosity, has anyone attempted SSG 100% in-canister? ICP supports 100% onchain and there are many product use cases where you’d want SSG fully automated in-canister.

1 Like

there are many product use cases where you’d want SSG fully automated in-canister.

For example, our future plans for OfficeX include web publishing documents (like how a google doc can be published to web and rank on SEO).

For example:

  • your officex drive contains 3 documents
  • you want to publish 1 document to open internet
  • your drive hosts the file SSG on https://<your_drive_canister_id>.icp0.io/published/document-001.html or yourcustomdomain.com/published/document-001.html

And possible even:

  • Global indexing at https://officex.app/public/<your_drive_canister_id>/published/document-001.html with 301/302 redirect or reverse proxy, sending search traffic to your self hosted asset canister
  • This can actually also be your corporate “public domain”, it doesnt have to be officex.app homepage

In such an automated setup, we would want 100% onchain SSG that “just works”. This would probably require our team to roll our own SSG, if theres no easy existing solution.

1 Like

What about Astro and upload all pre-rendert files into an Asset canister ?

Is that astro.build? Looks like its JS, in which case it would have same gotcha as NextJS, with the JS server being offchain. Ideally looking for something 100% in-canister.

I may just hop into trying the Shokunin Rust Crate and report back here.

EDIT: Ah i see, Astro & NextJS would be good options for anyone developing on Azle, nice! Thank you :pray:

1 Like