# Github Pages: issue working with public folder

**URL:** <https://discourse.gohugo.io/t/github-pages-issue-working-with-public-folder/51287>\
**Category:** support\
**Created:** [August 25, 2024, 10:25am UTC](https://discourse.gohugo.io/t/github-pages-issue-working-with-public-folder/51287 "2024-08-25T10:25:41Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![peterkorteweg](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/peterkorteweg/32/22767_2.png) [@peterkorteweg](https://discourse.gohugo.io/u/peterkorteweg)\
**Post date:** [August 25, 2024, 10:25am UTC](https://discourse.gohugo.io/t/github-pages-issue-working-with-public-folder/51287/1 "2024-08-25T10:25:41Z")

</div>

Hi, I have created a Github Pages site with Hugo (theme Gokarna), but CSS does not seem to work: the dark/light mode is not available.

**Steps**

1. Create Github repo,
2. Locally run “hugo”. This creates a ‘public’ folder,
3. Push ‘public’ folder to Github Pages, as explained in Hugo basic usage documentation:

> " In a simple hosting environment, where you typically `ftp`, `rsync`, or `scp` your files to the root of a virtual host, the contents of the `public` directory are all that you need."

The Gokarna example website has a CSS with a dark/light theme that can be set at the top right. My website does not show that option. Locally my website does show a dark/light theme.

Gokarna example website: [https://gokarna-hugo.netlify.app/](https://gokarna-hugo.netlify.app/)  
My public folder on Github: [GitHub - peterkorteweg/peterkorteweg.github.io: Files for Github Pages.](https://github.com/peterkorteweg/peterkorteweg.github.io)

Can you explain why is a copy of the local ‘public’ folder not working as expected?

---

<div class="post-metadata">

**Author:** ![irkode](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/irkode/32/26135_2.png) [@irkode](https://discourse.gohugo.io/u/irkode)\
**Post date:** [August 25, 2024, 11:18am UTC](https://discourse.gohugo.io/t/github-pages-issue-working-with-public-folder/51287/2 "2024-08-25T11:18:26Z")

</div>

You have an active jekyll build action. This builds your site an publishes it. But not from your sites root.

Looks like you have to reconfiger your github pages deployment setting. Have a look at this answer.

> [@Links not working](https://discourse.gohugo.io/t/links-not-working/50780/11):
>
> Hint: seems you generate your html locally, but your pages repo has an active action that tries to build with jekyll. I’d recommend to configure either Static HTML By GitHub Actions or serve from branch in your Gihub Pages settings. No need to have a build step. If you tend to build from source using actions have a look at

---

<div class="post-metadata">

**Author:** ![peterkorteweg](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/peterkorteweg/32/22767_2.png) [@peterkorteweg](https://discourse.gohugo.io/u/peterkorteweg)\
**Post date:** [August 25, 2024, 12:15pm UTC](https://discourse.gohugo.io/t/github-pages-issue-working-with-public-folder/51287/3 "2024-08-25T12:15:58Z")

</div>

Thanks for the help. I use the option “Deploy from a branch” on Github. But indeed I can see that this option triggers an action to build with Jekyll. I will read the documentation on Github Pages to see how I can turn off a Jekyll build.

---

<div class="post-metadata">

**Author:** ![irkode](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/irkode/32/26135_2.png) [@irkode](https://discourse.gohugo.io/u/irkode)\
**Post date:** [August 25, 2024, 2:41pm UTC](https://discourse.gohugo.io/t/github-pages-issue-working-with-public-folder/51287/4 "2024-08-25T14:41:27Z")

</div>

Sometimes you will have to unpublish your site and then reenable publish to make it working.

Either from branch or using the static html action as described in the linked answer

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [August 25, 2024, 2:58pm UTC](https://discourse.gohugo.io/t/github-pages-issue-working-with-public-folder/51287/5 "2024-08-25T14:58:42Z")

</div>

[https://gohugo.io/hosting-and-deployment/hosting-on-github/](https://gohugo.io/hosting-and-deployment/hosting-on-github/)

This workflow is used by thousands of sites.

---

<div class="post-metadata">

**Author:** ![peterkorteweg](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/peterkorteweg/32/22767_2.png) [@peterkorteweg](https://discourse.gohugo.io/u/peterkorteweg)\
**Post date:** [August 25, 2024, 3:49pm UTC](https://discourse.gohugo.io/t/github-pages-issue-working-with-public-folder/51287/6 "2024-08-25T15:49:05Z")

</div>

Thank you @irkode and @jmooring for your help. I decided to use the workflow for hosting on Github. This means I had to push my “raw” website content to Github and run Hugo via the workflow from @jmooring.

I was under the impression that I could also run a static workflow on the “public” folder on Github, but as described above that did not work with the Gokarna theme.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [August 25, 2024, 3:57pm UTC](https://discourse.gohugo.io/t/github-pages-issue-working-with-public-folder/51287/7 "2024-08-25T15:57:12Z")

</div>

With this workflow there’s no need to check the public directory into source control.

Add `public/` to your .gitignore file then:

```auto
git rm -rf public
git add -A
git commit -m "Remove publid directory from source control"
git push

```

---

<div class="post-metadata">

**Author:** ![irkode](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/irkode/32/26135_2.png) [@irkode](https://discourse.gohugo.io/u/irkode)\
**Post date:** [August 25, 2024, 4:24pm UTC](https://discourse.gohugo.io/t/github-pages-issue-working-with-public-folder/51287/8 "2024-08-25T16:24:02Z")

</div>

> [@peterkorteweg](#):
>
> I was under the impression that I could also run a static workflow

Just for clarification:

You _can_ use the content of a hugo build using _Github actions_ → _Static HTML_.

But I’m with @jmooring. The workflow is easy to setup, easy to operate and stable. And you don’t have to separate source and publish. Just push sources and you’re done.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [August 27, 2024, 4:24pm UTC](https://discourse.gohugo.io/t/github-pages-issue-working-with-public-folder/51287/9 "2024-08-27T16:24:45Z")

</div>

Closed on August 27, 2024, 4:24pm UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
