Colocated Hugo Marketing Site/Blog + JS App - Best Practices, Ideas, Community Thoughts?

Hi all - long time software architect person, and recently got turned onto Hugo. I’d previously liked Jekyll & Ghost, but there are some projects where it would be great to roll out a static marketing/blog/static site, and colocate it with an application.

For example:

  • / goes to Hugo homepage
  • /about goes to Hugo static page
  • /contact … ^^, you get the picture
  • /login || /signup goes to app routes (i.e. React, Express, PHP, etc)
  • /some/app/route goes to app

Initial thoughts on doing this are:

  • Run Hugo & app separately & use web proxy (HAProxy, Apache, etc) to route between them
  • Have Hugo site live within public-like directory, and configure the routes in-app (i.e. within Express, etc)

Any thoughts from the community on how you’ve done this, any best practices that you’ve come across/used, any other thoughts? Looking forward to responses.

You could use Nginx as a frontend proxy and route the requests properly.

location /blog {
  try_files @proxy_for_blog...

location /app2 {
  try_files @proxy_for_app2...
1 Like

@minhajuddin - yes, good idea. That’s the proxy approach I was thinking about, and totally doable. That will also require all routes, which I guess one can come up with a simple convention to route things.

What I have in mind is being able to have, say, a React & API or Meteor application, and have a Hugo static site bundled in the same repo.