I am about to migrate from WP to Hugo, and I would need some advices from experienced users about the “daily usage” when using Hugo.
Here is where I am : I have installed Hugo locally on my desktop (running EndeavourOS), installed Stack theme and personalized it, migrate content (~1500 posts) from WP thanks to the great wp2hugo tool, reorganized my content sorting existing posts within YEAR/MONTH folders, then for each post creating one dir with .md file and related pictures or media files (following the “page bundle” recommendation). So I am ready to publish the project and push the “public” folder to my hosting provider.
My question is about best practices for a daily usage, tools to use, etc…
what is the best way to create new posts ? I have seen there some visual editor one can use to ease the post creation process, like WYSIWYG editor, frontmatter, etc. : do you recommend some for a Linux user ? I guess it may be easier with such tool to select the expected folder I want to use (because of my folder organization), rather than using “hugo new content” command line ?
So I plan to create my new content locally on my desktop, redacting the index.md file, copying images etc… in the same folder. And check output on my local hugo instance.
So when the new post is ready, how do you publish it ? I suppose best is to simply copy new post folder to the host provider ? no need to run hugo command again to publish all site, right ? Am I right ?
Thank you for your answers, any recommendation for the "day after migration’ is very welcome !
I spend a lot of time in the terminal so for creating new posts I just use the hugu new … command. I have set newContentEditor: in hugo.yaml to my preferred editor so the post opens up there.
To deploy to a standard web-server I use this one liner script. I name in deploy.sh and place it in the project root.
#!/usr/bin/env sh
hugo --cleanDestinationDir && rsync -e 'ssh -ax' --archive --delete --verbose --compress --human-readable public/ host.example.org:/path/to/web/root/
This script builds the site and then use rsync to copy all changed files over, rsync will also in this script delete any removed file making the copy on the server identical to local.
If you are comfortable with the terminal, use it! If you need to configure an online editor, use open source ones like Decap or those with free tiers like Sitepins or Cloudcannon. There is also Frontmatter that works inside your code editor.
That shows using the terminal should work for you. Just create content archetypes if you need different front matter entries e.g news.md, then you can do e.g hugo new content -k news /news/foo/index.md.
Here I prepared a step by step instruction how to setup simple publishing pipeline based on GitHub actions. Basically new commit pushed to repository initiate a deploy process. Maybe someone will find this useful.
Thanks for mentioning Sitepins. Just wanted to inform you that Sitepins is now also open source under the Elastic License 2.0. (hasn’t been publicly announced yet)
I have the Hugo project in a private Github repo. Create new content in markdown locally, then commit and push. The free hosting on Cloudflare Pages then picks up the Github changes and re-builds the site automatically.
Thanks, looks like a very good doc, but I don’t feel comfortable with Github, not being a dev guy, so I prefer to keep it simple with my local setup and a rsync script for update.
One thing that has really changed the way I publish is the way Forgejo’s actions are set up.
I have a self-hosted instance of Forgejo, and whenever I want to edit a theme or publish a new post, I create a branch; as soon as I’m done, I merge it, and a simple `git push` takes care of the publication.
Of course, this can be done using GitHub or other servers that support actions.
In the past, as many have suggested, I too used a Bash script that generated the content and then copied it to a remote folder.
However, a huge advantage of using Git is the ability to revert to a previous version at any time.
If you use it every day, it probably doesn’t make sense to create a branch every time.
Even if you’re not a git expert, with the help of any AI tool, you can set up the actions in a couple of hours.