Set up your website (legacy method)
This is currently the only method which supports custom domains. Support for custom domains with the new method is coming soon.
Show the legacy method
1 Set up your repository
Create a public repository named pages to make the site available at the main subdomain.
or
Create a branch pages in a public repository:
git switch --orphan pagesgit rm --cached -r .
2 Upload your files
Push your static content, HTML, style, fonts, images or anything else.
3 You're done!
Access your new website using this link:
https://USERNAME.codeberg.page[/REPOSITORY][/@BRANCH]
or
To use a custom domain, create a file .domains in your repository with the domain name you wish to use.
Then, add a DNS record for that domain:
CNAME [[branch.]repo.]user.codeberg.page.
Or for apex domains where CNAME doesn't work:
ALIAS codeberg.page.
TXT [[branch.]repo.]user.codeberg.page
If ALIAS isn't supported, use add the TXT record as described above, and use A+AAAA as following:
A 217.197.84.141
AAAA 2a0a:4580:103f:c0de::2
Set up your website (new method without CI)
1 Set up your repository
Create a public repository named pages with a branch called pages to make the site available at the main subdomain.
or
Create a branch pages in a public repository:
git switch --orphan pagesgit rm --cached -r .
2 Set up deployment
In the Settings for your repository, go to Webhooks and click Add webhook.
Select Forgejo from the drop down list of webhook types.
Set the Target URL to https://USERNAME.codeberg.page/REPOSITORY, replacing USERNAME with your user or organization name and REPOSITORY with the name of your repository.
(If your repository is called pages, omit it.)
Set the Branch filter to pages.
Click Add webhook.
3 Upload your files and you’re done!
Push your static content, HTML, style, fonts, images or anything else. They will be accessible at https://USERNAME.codeberg.page[/REPOSITORY].
Set up your website (new method with CI)
If you use a static site generator like Jekyll, Hugo, or any other similar tool, you can integrate deployment into the Forgejo Actions workflow which builds your site instead of using the webhook.
To learn how to do this, see our documentation.