[SOLVED] Hugo push

What are your opinions about a hugo push-like command? The goal would be to publish the /public directory to a remote location. For now, what I do is kind of:


hugo && rsync -avz --delete public/ ${USER}@${HOST}:~/${DIR}

exit 0

The main issue is that we all have specific needs to publish. So why not deciding that Hugo cannot do it? IMO this would require too much includes and would not be feasible for big companies that have specific tests and integration tasks.

But what we could do is, we could specify a push command just inside the config file, and this way hugo would be method-agnostic when it comes to publication.

We could set something like this in the config file:

push: 'make publish'       # in case of Makefile
push: init.sh              # in case of shell script

The capital gain is that Hugo could launch that command when needed. For instance, we could add later a hugo full-update command that updates themes, widgets, builds the whole site and publish it.

What do you think of it? Do you think we should do it this way?

Hi @lebarde. IMHO, I’m not sure about Hugo diving too much into the deploy-to-server territory. My current push is really just a get push and I let others take care of the rest. You already mention this wouldn’t work for big companies, but I was hoping you could expand on the utility of adding this to Hugo rather than, say, a .bash_profile or the like. If a user has the wherewithal to create a makefile, bash script, etc, wouldn’t he/she also be able to set up an alias for something like this?

Not saying this is totally out of the question. I’m just curious about your ideal use case :smile: Thanks!

1 Like

I agree with the guy above me. I think that is asking too much of Hugo. It sounds like you might want to look into a continuous integration process such as using CircleCI or Travis CI.

For example, my build process runs Hugo to generate the website, then it runs HTML Proofer to test the site, then it deploys it to a Linode VPS server.

I can provide more details and show you example if that seems like something you’d like. Having Hugo do all of that though doesn’t make sense to me.

1 Like

You are absolutely right: I was especially thinking of an all-in-one hugo full-upgrade command that updated everything, builded the whole site and published it. But actually it can already be done with a script file.

Thanks for your enlightenments! :slightly_smiling:

You may also enjoy: https://github.com/laurilehmijoki/s3_website

1 Like

Nice @jhabdas Also from the lead dev himself:

I saw that. It looks very promising as s3_website’s pitfall is speed and size as a dev dependency. s3_website also requires both Java and Ruby code to run. If it can be replaced it would be perfect for running in a Lambda to dynamically compile Hugo for UGC.