Github: Should you separate your Hugo content from the generated html by creating two repos?

I’ve seen at least one theme creator suggesting this. It seems to make sense, but, being a beginner, why would it be a “healthy” option, and is it bad if we choose to keep everything in the same repo?

Basically, what I’m asking is what would be the rationale for choosing either option.

1 Like

For most it is a matter of preference. I don’t keep the generated files in version control, because I’ve no reason to, and don’t want to track them. Some folks can’t do this, and some folks have to do this, depending on how their site is deployed.

I don’t use GitHub, so I am not sure if it generates sites for Hugo, so if you are hosting your site there (GitHub Pages), then you should follow the instructions for deploying there. :slight_smile:

For what it is worth, I keep source files in version control, and then I deploy sites to other systems. I never keep any generated files in version control. It is like double committing or more each time you make an update…

2 Likes

Hmm… Well, I’m thinking of hosting through Netlify, so I am not sure what the best option would be—I was hoping understanding the reasons behind each one would help me decide…

Come to think of it, I’m not sure the hosting provider I go with renders this question futile.

Keeping the generated files in version control doesn’t make much sense for me either.

You tell Netlify the engine and version (ex: Hugo 0.30) and then it builds your site for you. No need to keep generated output in version control for that. Check Netlify’s docs, it should explain everything, such as telling them which version of Hugo to use.

1 Like

Exactly this. I have deployed sites using Gitlab CI and Netlify and both do not need you to commit the HTML files.

The Gitlab CI runner or Netlify will do the job of generating the HTML files on the fly. You commit just the source files.

I don’t know if the Github Pages flow requires committing HTML files… which seems like a waste.

1 Like

Yeah, maybe someone hosting on GitHub Pages can chime in. I recall it having to read the gh-pages branch, and they only process Jekyll files, but I don’t keep up with that. Don’t matter, they make it extremely hard to use HTTPS, so it ought to be avoided all together. :slight_smile:

That’s why I’m thinking of Netlify – they make it so easy to use HTTPS.

So this question is only relevant if hosting through GitHub Pages. Got it. Thanks, @maiki and @kaushalmodi, this was helpful.

1 Like

I use Netlify.
I don’t commit the generated public directory to version control.
I would at least start like this Claudia - it will keep things easy for you and you can always change in the future if you want to (though I think you’ll be very happy with the Netlify set up).