Update codeberg.page for git-pages custom domain support

This commit is contained in:
Daphne Preston-Kendal
2026-04-26 10:52:57 +02:00
parent 5325fd72c6
commit 522c5d0c07

View File

@@ -115,80 +115,19 @@
</div>
<div class="content">
<h3>Set up your website (legacy method)</h3>
<h3>Set up your website (with CI)</h3>
<p>
<strong>This is currently the only method which supports custom domains.</strong> Support for custom domains with the new method is coming soon.
<strong>If you use a static site generator</strong> like Jekyll, Hugo, or any other similar tool, you can integrate deployment into the <a href="https://docs.codeberg.org/ci/actions/">Forgejo Actions</a> workflow which builds your site.
</p>
<p>
To learn how to do this, see <a href="https://docs.codeberg.org/codeberg-pages/forgejo-actions/">our documentation</a>.
</p>
<h3>Set up your website (without CI)</h3>
<p>
If you just want to serve plain old hand-made static files, you can also configure a webhook on your repository to deploy changes to Codeberg Pages.
</p>
<details>
<summary>Show the legacy method</summary>
<div class="card" style="max-width: 80em; margin: 0 auto;">
<div class="row" style="gap: var(--content-and-card-spacing)">
<div class="col-lg">
<h4 class="text-center">
<span class="codeberg-number-circle">1</span>
Set up your repository
</h4>
<p>
Create a public repository named <code class="code">pages</code> to make the site available at the main subdomain.
</p>
<div class="codeberg-divider"><hr>or<hr></div>
<p>
Create a branch <code class="code">pages</code> in a public repository:<br>
<code class="code">git switch --orphan pages</code><br><code class="code">git rm --cached -r .</code>
</p>
</div>
<div class="col-lg">
<h4 class="text-center">
<span class="codeberg-number-circle">2</span>
Upload your files
</h4>
<p>
Push your static content, HTML, style, fonts, images or anything else.
</p>
<!--<div class="codeberg-divider">or</div>
<p>
Push the source for your page based on any static site generator, and <a href="">compile it with Codeberg CI</a>.
</p>-->
</div>
<div class="col-lg">
<h4 class="text-center">
<span class="codeberg-number-circle">3</span>
You're done!
</h4>
<p>
Access your new website using this link:<br>
<code class="code">https://USERNAME.codeberg.page[/REPOSITORY][/@BRANCH]</code>
</p>
<div class="codeberg-divider"><hr>or<hr></div>
<p>
To use a custom domain, create a file <code class="code">.domains</code> in your repository with the domain name you wish to use.
</p>
<p>
Then, add a DNS record for that domain:<br>
<code class="code">CNAME [[<i>branch</i>.]<i>repo</i>.]<i>user</i>.codeberg.page.</code>
</p>
<p>
Or for apex domains where CNAME doesn't work:<br>
<code class="code">ALIAS codeberg.page.</code><br>
<code class="code">TXT [[<i>branch</i>.]<i>repo</i>.]<i>user</i>.codeberg.page</code>
</p>
<p>
If ALIAS isn't supported, use add the <code class="code">TXT</code> record as described above, and use <code class="code">A</code>+<code class="code">AAAA</code> as following:
</p>
<div class="alert" role="alert">
Warning: Our IP addresses have changed in April 2025.
Please make sure to update your DNS records accordingly for your existing domains.
</div>
<p>
<code class="code">A 217.197.84.141</code><br>
<code class="code">AAAA 2a0a:4580:103f:c0de::2</code>
</p>
</div>
</div>
</div>
</details>
<h3>Set up your website (new method without CI)</h3>
<div class="card" style="max-width: 80em; margin: 0 auto;">
<div class="row" style="gap: var(--content-and-card-spacing)">
<div class="col-lg">
@@ -217,8 +156,9 @@
Select <b>Forgejo</b> from the drop down list of webhook types.
</p>
<p>
Set the <b>Target URL</b> to <code class="code">https://USERNAME.codeberg.page/REPOSITORY</code>, replacing <code class="code">USERNAME</code> with your user or organization name and <code class="code">REPOSITORY</code> with the name of your repository.
Set the <b>Target URL</b> to the URL of your website. If you dont have a custom domain, thats <code class="code">https://USERNAME.codeberg.page/REPOSITORY</code>, replacing <code class="code">USERNAME</code> with your user or organization name and <code class="code">REPOSITORY</code> with the name of your repository.
(If your repository is called <code class="code">pages</code>, omit it.)
If you have a custom domain, remember to <a href="#dns-configuration">configure it with the instructions below</a>.
</p>
<p>
Set the <b>Branch filter</b> to <code class="code">pages</code>.
@@ -243,12 +183,25 @@
</div>
</div>
<h3>Set up your website (new method with CI)</h3>
<h3 id="dns-configuration">Custom domain configuration</h3>
<p>
If you use a static site generator like Jekyll, Hugo, or any other similar tool, you can integrate deployment into the <a href="https://docs.codeberg.org/ci/actions/">Forgejo Actions</a> workflow which builds your site instead of using the webhook.
To use a custom domain, create a file <code class="code">.domains</code> in your <code>pages</code> branch with the domain name you wish to use.
</p>
<p>
To learn how to do this, see <a href="https://docs.codeberg.org/codeberg-pages/">our documentation</a>.
Then, add a DNS record for that domain:<br>
<code class="code">CNAME [[<i>branch</i>.]<i>repo</i>.]<i>user</i>.codeberg.page.</code>
</p>
<p>
Or for apex domains where CNAME doesn't work:<br>
<code class="code">ALIAS codeberg.page.</code><br>
<code class="code">TXT [[<i>branch</i>.]<i>repo</i>.]<i>user</i>.codeberg.page</code>
</p>
<p>
If ALIAS isn't supported, use add the <code class="code">TXT</code> record as described above, and use <code class="code">A</code>+<code class="code">AAAA</code> as following:
</p>
<p>
<code class="code">A 217.197.84.141</code><br>
<code class="code">AAAA 2a0a:4580:103f:c0de::2</code>
</p>
</div>
</div>