So your answer actually just added to my confusion since it seems to me that you actually disagree with hugo’s documentation. Let me go through it again in detail, so you can point out where I went wrong.
To quote github’s docs: About GitHub Pages - GitHub Docs
If the default publishing source exists in your repository, GitHub Pages will automatically publish a site from that source. The default publishing source for user and organization sites is the root of the default branch for the repository. The default publishing source for project sites is the root of the gh-pages
branch.
Now I made a github page using username dot github dot io by creating a repository called username dot github dot io. So from the above quote I conclude: publishing is done from the root of the default branch. In my case, that’s master
(opposed to main
which is by default used on github.)
Now the docs of hugo say: Host on GitHub Pages | Hugo
Content from the main
branch will be used to publish your GitHub Pages site
whereas, again, we create a user github page.
So now you have the following situation: You have the source files in / and the generated static files in /public. /public is what is being served by your webserver i.e. what is being hosted. Now, from both quotes above we know that the default branch is being served but now, since we only have on repo, the default branch contains / and not /public.
So github tries to served everything.
I then assumed that hugo uses the action to A) generate the static files after a push B) tell github pages “served /public folder”.
After googling a lot and everyone seeming to use two repos I opted for that and concluded: I don’t understand the hugo docs.
Especially because of this
This is a much simpler setup as your Hugo files and generated content are published into two different repositories.
I read that as “The above setup is much simple because we divide hosted files and source into two repos”. The whole sentences is confusing not only because of the formulation but also because we didn’t even set up anything, we just discussed stuff.
Question:
- Why do you think that
gh_pages
is being served for a user github page when the docs clearly state the default branch is being served?
- Assuming 1. is correct and I want to use one repository. How should that be possible to set up?
Edit: How come a new user can’t post infinite links. the “dot” in the links means “.”
Currently I’d solve it like this: 1 repo with a master
branch and a hosting
branch. (You may or may not name it gh_pages
but I think that’d be wrong because that might imply that the github pages are project pages) and the just set the branch from which pages are being served to hosting
in the settings. Then furthermore add an action that builds “into” the hosting
branch on push. (But I’m too much of a noob yet to to the action).
I also want to stress that your example proved my point. The repo name != maintainer name => project type not user type => he needs to use the gh_pages
branch.
Now I don’t have a project, I just want to use github for hosting and maintaining the site itself. I want something personal, so I opted for a user page which means repo name == maintainer name which implies that there’s no gh_pages
branch.