Modify Codeberg Pages article for Pages v2

This commit is contained in:
fnetx 2021-12-01 23:13:34 +01:00
parent b585d2f989
commit 9a355bb8c9
No known key found for this signature in database
GPG key ID: 03870C95EE9F2661

View file

@ -6,12 +6,44 @@ eleventyNavigation:
order: 60
---
Codeberg allows you to publish static web content (HTML, images, etc) with a human-friendly address ({user-name}.codeberg.page).
Codeberg Pages allows you to easily publish static websites with a human-friendly address (`{user-name}.codeberg.page`) via Git on Codeberg.org.
Follow the simple steps below to get started, or check out the advanced usage below.
1. Create a repository named 'pages' in your user account or organization.
2. Create static content, HTML, style, fonts or images. Name the homepage file 'index.html'
2. Create static content, HTML, style, fonts or images. Name the homepage file `index.html`
3. Push your content to the main branch of the new repository.
4. You should now be able to access your content using the domain '{user-name}.codeberg.page'.
4. You should now be able to access your content using the domain `{user-name}.codeberg.page`.
See also [https://codeberg.page/](https://codeberg.page)
## Advanced Usage: Canonical URLs
The Codeberg Pages server responds to four different URLs:
- `https://raw.codeberg.org/username/reponame/`: raw content, uses correct MIME types (HTML is forbidden though) and is accessible with CORS.
- `https://username.codeberg.page`: user page, points the default branch of a user's or organization's `pages` repository
- `https://username.codeberg.page/reponame/`: repo page, points to the `pages` branch of the repository
- `https://example.org`: custom domain, points to a repo of choice as outlined below
In all cases, you can append a branch using an `@` (e.g. `https://username.codeberg.page/@develop/README.md`).
## Custom Domains
> **WARNING:** Custom domains aren't fully tested yet and you may run into Let's Encrypt Rate Limits for your domains. It is recommended to try it out on an unused subdomain first so you can make one request, and if it fails, contact us and we can check what the problem is. A better process for such errors is being worked on.
> Currently known pitfalls:
> - you must either not have a [CAA record](https://en.wikipedia.org/wiki/DNS_Certification_Authority_Authorization#Record), or explicitly allow [LetsEncrypt](https://letsencrypt.org) there
For custom domains, two things are required:
- a `.domains` file in the repository (in the branch in question), containing a list of domains that shall be usable to access that repository:
- One domain per line, you can leave lines empty and comment out lines with `#`.
- All domains (including `*.codeberg.page`) will be redirected to the first domain in that file.
- a CNAME record pointing to one of the following targets:
- `username.codeberg.page` → https://username.codeberg.page
- `reponame.username.codeberg.page` → https://username.codeberg.page/reponame/
- `branchname.reponame.username.codeberg.page` → https://username.codeberg.page/reponame/@branchname/
If you can't use a CNAME record to configure the target (e.g. for a zone root), you can use an A/AAAA/ALIAS record to `codeberg.page` with an additional TXT record for the target (just as shown above for CNAME records).
## Having Questions, Feedback or found a bug?
The source code for Codeberg Pages is maintained over at the [Pages Server repository](https://codeberg.org/Codeberg/pages-server), feel free to head there and providing some feedback, suggestions, sending bug reports or patches. We really appreciate your contribution.