Dynamically Rendering Hugo Pages?

It would be cool if there was a way to render Hugo pages dynamically like Eleventy Serverless. A possible use case could be doing server side search where you return a page of rendered results built with Hugo’s templates.

1 Like

This can be done also easily with netlify.io serverless functions in basic hugo.

And if i’m not wrong (never used elevently), elevently needs netlify too for this.

Isn’t this the exact opposite of a static site? Why do this with Hugo?

Because you might still want to use Hugo for the thousands static files you will build on top of your “on-demand” pages.


Okay, but for the given use case:

It works just fine to use Algolia to power the search. The search is server side, but rendering is client side. So it is far more efficient than any server side rendering approach.

True, this approach doesn’t use hugo templates, but it uses flexible javascript templating engine, which can pick up the templating string from a tag in webpage. With the right parameters and partials, it should be possible to use a hugo template to generate that templating string, if you are so inclined.

I know I could create a template to use with JS and manipulate it serverside.

Thing is I it would be nice if I could make a request which can be built using the Hugo templates I set up by giving Hugo a bunch of data to render when needed.

1 Like

Server side rendering also allows your search to work without JS!

See Everyone has JavaScript, right? :wink: