# Is it possible to use Hugo in Codeberg Page repositories?

**URL:** <https://discourse.gohugo.io/t/is-it-possible-to-use-hugo-in-codeberg-page-repositories/31012>\
**Category:** support\
**Created:** [February 3, 2021, 6:00am UTC](https://discourse.gohugo.io/t/is-it-possible-to-use-hugo-in-codeberg-page-repositories/31012 "2021-02-03T06:00:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![fletchi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/fletchi/32/13463_2.png) [@fletchi](https://discourse.gohugo.io/u/fletchi)\
**Post date:** [February 3, 2021, 6:00am UTC](https://discourse.gohugo.io/t/is-it-possible-to-use-hugo-in-codeberg-page-repositories/31012/1 "2021-02-03T06:00:19Z")

</div>

I look that [Codeberg](https://codeberg.org/) (a german git hosting) has the feature for to publish static [web content](https://docs.codeberg.org/codeberg-pages/). But the service seems very simple, I’ve searching on his web and I can’t find personal projects that use Hugo. The majority of webs use vanilla html + css (and some js).

As there are some really beautiful themes of Hugo in many places, I will like to use some of them on Codeberg, but it isn’t like Github or Gitlab so, How to use a Hugo theme with Codeberg Page service?

---

<div class="post-metadata">

**Author:** ![frjo](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/frjo/32/18626_2.png) [@frjo](https://discourse.gohugo.io/u/frjo)\
**Post date:** [February 3, 2021, 7:31am UTC](https://discourse.gohugo.io/t/is-it-possible-to-use-hugo-in-codeberg-page-repositories/31012/2 "2021-02-03T07:31:18Z")

</div>

Hugo generates plain html/css/js so you can host it anywhere.

You will most likely need to run Hugo locally and push the generated content (the content of the “public” folder) to the “pages” repo on Codeberg.

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [February 3, 2021, 9:21am UTC](https://discourse.gohugo.io/t/is-it-possible-to-use-hugo-in-codeberg-page-repositories/31012/3 "2021-02-03T09:21:49Z")

</div>

```auto
Codeberg Pages
Codeberg allows you to publish static web content (HTML, images, etc) with a human-friendly address ({user-name}.codeberg.page).

Create a repository named 'pages' in your user account or organization.
Create static content, HTML, style, fonts or images. Name the homepage file 'index.html'
Push your content to the main branch of the new repository.
You should now be able to access your content using the domain '{user-name}.codeberg.page'.
See also https://codeberg.page/

```

See your link [Codeberg Pages | Codeberg Documentation](https://docs.codeberg.org/codeberg-pages/)

That means the following:

1. remove an existing `public` directory in your hugo repo
2. create a repo `pages` in your codeberg account
3. clone the repo pages into `public` (so that the root content of `pages` is in the “root” of `public`, no subfolder-games 😉 )
4. create a bash script (`build.sh` for this sample) in your repo root and add the following code (what it does follows):

```auto
#!/bin/sh

hugo
cd public
git add -A
git commit -m "site update"
git push origin master

```

Make it executable and run if you want to upload changes to codeberg.

What it does:

- build the site
- add the site to your pages repo
- push them up

That should put the site online on username.codeberg.page.

You can optimize that regarding some points:

- remove existing built files in public before publishing hugo again (because if you use pipes then old files will clutter up your repo)
- add a nicer commit message for the site.

I remember having had a script that creates a github pages branch from a public directory, but I can’t find it. That might be easier than having the pages repo inside of your hugo repo.

---

<div class="post-metadata">

**Author:** ![fletchi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/fletchi/32/13463_2.png) [@fletchi](https://discourse.gohugo.io/u/fletchi)\
**Post date:** [February 4, 2021, 12:26am UTC](https://discourse.gohugo.io/t/is-it-possible-to-use-hugo-in-codeberg-page-repositories/31012/4 "2021-02-04T00:26:44Z")

</div>

Thanks for your help. A simple explanation is:

- Run `hugo` locally
- A push the `public` folder to `pages` repository on [codeberg.com](http://codeberg.com)

And… Do I do the same process every new post that I’ll make?

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [February 4, 2021, 6:34am UTC](https://discourse.gohugo.io/t/is-it-possible-to-use-hugo-in-codeberg-page-repositories/31012/5 "2021-02-04T06:34:56Z")

</div>

> [@fletchi](#):
>
> And… Do I do the same process every new post that I’ll make?

Yes, with any change.

---

<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:** [April 30, 2021, 4:59pm UTC](https://discourse.gohugo.io/t/is-it-possible-to-use-hugo-in-codeberg-page-repositories/31012/6 "2021-04-30T16:59:41Z")

</div>

A post was split to a new topic: [Hugo does not create a public directory](https://discourse.gohugo.io/t/hugo-does-not-create-a-public-directory/32641)

---

<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:** [April 30, 2021, 5:00pm UTC](https://discourse.gohugo.io/t/is-it-possible-to-use-hugo-in-codeberg-page-repositories/31012/7 "2021-04-30T17:00:14Z")

</div>


