Hugo for e-commerce


#1

I’m looking to use Hugo for an e-commerce site with ~30 000 products. I want to generate a static html file for every product. But if I update a product, is it possible to tell Hugo to only build that specific product page?


#3

It’s for an e-commerce site. If a product is sold out I would want to render a new product page immediately, and also not affect the caching of every other product page.

The initial build time for all the products is not important. Maybe I could run Hugo N amount of times the very first time (and on changes to template/markup), this would let me do ‘incremental’ builds of product pages.

I want a Kafka consumer to build a new product page if any of the essential product data changes. For example:

  • product goes in/out of stock
  • product stock state changes (3 potential states: “few in stock”, “in stock”, “20+ in stock”)
  • a product variant (most likely different colours) goes in/out of stock.

There are really not that much dynamic content on a product page of a ecommerce site, I really wanna avoid server side rendering, because of cache advantage, performance and simplicity.

Any input is appreciated.


#4

You most likely need a JavaScript solution on top of your Hugo installation.

There are commercial embedded shopping carts if you don’t want to do it yourself.

E-commerce is quite dynamic. Aside from JavaScript, I don’t see how you’d do inventory, order, user and so on management. Rebuilding the website every time doesn’t sound practical to me.

Edit: You’d also need a database server if you want to plan for concurrency.


#5

There’s a growing set of tools to layer ecommerce functionality into static sites, like https://commercelayer.io/ and https://snipcart.com/ or https://github.com/netlify/gocommerce