2020-08-02 08:13:08 -07:00
# Codeberg Documentation
2024-06-11 00:51:22 -07:00
2022-07-21 07:47:59 -07:00
This repository contains the [documentation for Codeberg ](https://docs.codeberg.org/ ), with some code to build it into
2020-08-13 03:29:36 -07:00
a static website.
2019-06-04 14:44:55 -07:00
2025-06-14 02:38:21 -07:00
Please have a look into it and consider to help writing the Documentation.
This is still very much work-in-progress, the more useful material we collect, the better we can later present it!
All contributions are very welcome!
2020-08-13 03:29:36 -07:00
2020-10-04 15:09:03 -07:00
For an introduction on contributing to Codeberg Documentation, please have a look
2022-04-13 04:18:00 -07:00
at [the section on improving the documentation ](https://docs.codeberg.org/improving-documentation/ ).
2020-10-04 15:09:03 -07:00
2020-08-13 03:29:36 -07:00
## Usage
2024-06-11 00:51:22 -07:00
2025-10-20 10:04:43 -07:00
### Local Development using nodejs
2024-06-11 00:51:22 -07:00
2020-08-25 02:54:12 -07:00
If you want to work on the documentation, for example by writing your own articles,
the easiest way to do so is to fork the documentation repository and develop locally.
2020-08-13 03:29:36 -07:00
2025-10-20 10:04:43 -07:00
To learn how to get `pnpm` see the [PNpm website ](https://pnpm.io ).
2020-08-25 02:54:12 -07:00
First, run
2020-08-13 03:29:36 -07:00
2024-06-12 01:44:42 -07:00
`pnpm install`
2020-08-13 03:29:36 -07:00
2020-08-25 02:54:12 -07:00
to install all dependencies (they will be installed only for this project, not globally).
You only have to do this once.
Then run
2020-08-13 03:29:36 -07:00
2025-11-21 12:40:44 -08:00
`pnpm run dev`
2020-08-13 03:29:36 -07:00
2020-08-25 02:54:12 -07:00
to start a development web server that by default is listening at `http://localhost:8080` .
Now you can simply change, add or remove files, save them and the development server
should automatically reload all changed pages using the amazing Browsersync.
When you're done, commit your changes to your fork and write a pull request for
Codeberg/Documentation. We're happy about every contribution!
2022-04-13 03:33:00 -07:00
### Local development using the Dockerfile
If you do not have nodejs installed or do not want to run the development web server directly on your host,
you can also use a docker container.
You must have a container-engine installed (docker, podman, etc.)
First build the container image:
```shell
2025-11-21 12:40:44 -08:00
docker build --tag codeberg-docs:dev .
2022-04-13 03:33:00 -07:00
```
You do not have to rebuild the image every time. Once you build the image you can always start the development
webserver using the container engine:
```shell
2025-11-21 12:40:44 -08:00
docker run --name "codeberg-docs" --rm --tty --interactive --volume "${PWD}:/docs" --publish "127.0.0.1:8080:8080/tcp" codeberg-docs:dev
2022-04-13 03:33:00 -07:00
```
Use the "External" URL the container outputs on startup to access your documentation.
Changes to files in the documentation are reflected in the browser as the server regularly updates the generated files.
Use `Ctrl-C` to exit / end the container.
The parameters are:
`--rm` removes the container after it's use
2025-11-21 12:40:44 -08:00
`--volume` mounts the current (documentation repository root) folder to `/docs` in the container.
2022-04-13 03:33:00 -07:00
2025-11-21 12:40:44 -08:00
`codeberg-docs:dev` refers to the container image built in the first step (using `docker build` ).
2022-04-13 03:33:00 -07:00
2020-08-25 02:54:12 -07:00
### Build & Deployment
2024-06-11 00:51:22 -07:00
2020-08-25 02:54:12 -07:00
Like for local development, before building and deploying you first have to install
the dependencies (once):
2024-06-12 01:44:42 -07:00
`pnpm install`
2020-08-25 02:54:12 -07:00
To build the entire website to the `_site` directory run
2020-08-13 03:29:36 -07:00
2024-06-12 01:44:42 -07:00
`pnpm run build`
2020-08-13 03:29:36 -07:00
2020-08-25 02:54:12 -07:00
Instead, to directly publish the page to Codeberg pages, you can also run
2024-06-12 01:44:42 -07:00
`pnpm run deploy`
2020-08-25 02:54:12 -07:00
2024-06-12 01:44:42 -07:00
which includes a call to `pnpm run build` .
2020-08-25 02:54:12 -07:00
2025-10-20 10:04:43 -07:00
### Check and fix formatting errors
Before you create a pull request with your changes, you should check and fix formatting errors.
Use the following command to fix formatting errors automatically:
`pnpx prettier . -w`
With the following command you can check if there are any formatting errors remaining:
`pnpx prettier . -c`
In addition you should also run the linter which is also used when checking pull requests:
`pnpx cspell lint --no-progress --gitignore '{**,.*}/{*,.*}'`
If this shows any errors, please fix them before committing your changes and creating a pull request.
2020-08-25 02:54:12 -07:00
### Technical Information
2024-06-11 00:51:22 -07:00
2020-08-25 02:54:12 -07:00
This website uses [Eleventy ](https://www.11ty.dev/ ), a static site generator.
It's supplied as a dev-dependency in `package.json` and its dependencies are locked
with `package-lock.json` to try to ensure reproducible builds.
2023-11-30 13:33:22 -08:00
It also uses [PageFind ](https://pagefind.app/ ), a static search library.
2020-08-13 03:29:36 -07:00
2025-06-14 02:38:21 -07:00
Deployment previews are generated for every PR using [Surge.sh ](https://surge.sh/ )
2026-01-15 23:36:00 -08:00
through the corresponding [Woodpecker plugin ](https://woodpecker-ci.org/plugins/surge-preview ).
2024-06-12 01:52:08 -07:00
2024-06-12 03:20:37 -07:00
A spellchecker is used to check for spelling errors in the documentation.
To add exceptions to the spellchecker, add them to the `.cspell.json` file.
2025-06-14 02:38:21 -07:00
This project is deployed to Codeberg via [a cron job ](https://codeberg.org/Codeberg-Infrastructure/scripted-configuration/src/branch/main/hosts/static/home/build/build_docs.sh )
executed on the Codeberg infrastructure.
2024-11-27 19:43:55 -08:00
2020-08-13 03:29:36 -07:00
## License and Contributors
2024-06-11 00:51:22 -07:00
2020-08-13 03:29:36 -07:00
This website (excluding bundled fonts) is licensed under CC BY-SA 4.0. See the [LICENSE ](LICENSE.md ) file for details.
2025-06-14 02:38:21 -07:00
Please refer to the [commit log ](https://codeberg.org/Codeberg/Documentation/commits/branch/main )
for an exhaustive list of contributors to Codeberg Documentation.