Forgejo website content - Code of Conduct https://codeberg.org/forgejo/code-of-conduct
  • XSLT 50.8%
  • Astro 40.2%
  • JavaScript 7.4%
  • CSS 1.5%
Find a file
2023-05-29 20:05:54 -04:00
.husky add pre-commit hook to automatically format staged files (#80) 2023-02-02 09:26:59 +00:00
.vscode reset theme to https://github.com/onwidget/astrowind 2022-12-01 18:04:49 +01:00
data fix typo 2023-05-21 10:33:31 +02:00
public docs: actions user documentation 2023-05-29 17:52:02 +02:00
src The labels key *is* required to be defined, but can be set explicitly to an empty list. Clarify this. Review @hexa @indeednotjames 2023-05-29 20:05:54 -04:00
.editorconfig reset theme to https://github.com/onwidget/astrowind 2022-12-01 18:04:49 +01:00
.eslintignore reset theme to https://github.com/onwidget/astrowind 2022-12-01 18:04:49 +01:00
.eslintrc.js add eslint and prettier 2022-11-11 09:17:39 +01:00
.gitignore ignore emacs backups 2022-11-14 22:09:30 +01:00
.npmrc reset theme to https://github.com/onwidget/astrowind 2022-12-01 18:04:49 +01:00
.prettierignore Add preview link to pull request 2023-03-03 03:17:01 -07:00
.prettierrc add pre-commit hook to automatically format staged files (#80) 2023-02-02 09:26:59 +00:00
.woodpecker.yml link next to v1.20 2023-05-15 09:26:18 +02:00
astro.config.mjs Update dependencies (#195) 2023-03-31 20:55:22 +00:00
LICENSE Fix licensing problems 2023-03-02 23:44:11 -07:00
package.json Run linting on the CI (#197) 2023-04-01 12:16:01 +00:00
pnpm-lock.yaml Update dependencies (#195) 2023-03-31 20:55:22 +00:00
README.md tip to pnpm run format locally 2023-04-28 17:13:37 +02:00
sandbox.config.json reset theme to https://github.com/onwidget/astrowind 2022-12-01 18:04:49 +01:00
tailwind.config.cjs Remove backticks from code elements 2023-02-19 17:43:04 +01:00
tsconfig.json format everything conformant to #80 2023-02-16 09:32:29 +01:00

Website for Forgejo

This website is built with Astro and Tailwind CSS, and is based on the AstroWind template.

When a branch foobar is pushed to the repository, the content is rendered for preview at https://forgejo.codeberg.page/@foobar/.

When a PR is created, its content is rendered for preview at https://forgejo.codeberg.page/@pull_1234/ where 1234 is the number of the PR.

The forgejo-website user is dedicated to providing an application token set to websitetoken and allows for publishing the branch and CI previews in https://codeberg.org/forgejo/pages.

Hosting

The website is hosted at https://uberspace.de and the technical details on how this is done can be found in the CI configuration at .woodpecker.yml

The sshpass password is not stored anywhere. It is set via https://dashboard.uberspace.de/dashboard/authentication and copied over to the secrets of the CI where it will never be displayed again. It can be verified to work with

SSHPASS=xyz rsync --rsh='sshpass -e ssh -oStrictHostKeyChecking=no -o PubkeyAuthentication=no' -av forgejo@atria.uberspace.de:html/ /tmp/html/

Google topics are disabled

[forgejo@atria ~]$ uberspace web header set / Permissions-Policy "browsing-topics=()"
Set header "Permissions-Policy: browsing-topics=()" for /

Project structure

The following is the default structure of the AstroWind template:

/
├── data/
|   └── blog/
|       ├── post-slug-1.md
|       ├── post-slug-2.mdx
|       └── ...
├── public/
│   ├── robots.txt
│   └── favicon.ico
├── src/
│   ├── assets/
│   │   ├── images/
|   |   └── styles/
|   |       └── base.css
│   ├── components/
│   │   ├── atoms/
│   │   ├── blog/
│   │   ├── core/
|   |   └── widgets/
|   |       ├── Header.astro
|   |       ├── Footer.astro
|   |       └── ...
│   ├── layouts/
│   |   |── BaseLayout.astro
│   |   └── ...
│   ├── pages/
│   |   ├── [...blog]/
|   |   |   ├── [...page].astro
|   |   |   └── [slug].astro
│   |   ├── [...categories]/
|   |   |   └── [category]/
|   |   |       └── [...page].astro
│   |   ├── [...tags]/
|   |   |   └── [tag]/
|   |   |       └── [...page].astro
│   |   ├── index.astro
|   |   ├── 404.astro
|   |   └-- rss.xml.js
│   ├── utils/
│   └── config.mjs
├── package.json
└── ...

Astro looks for .astro or .md files in the src/pages/ directory. Each page is exposed as a route based on its file name.

There's nothing special about src/components/, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.

Any static assets, like images, can be placed in the public/ directory if they do not require any transformation or in the assets/ directory if they are imported directly.

Commands

All commands are run from the root of the project, from a terminal:

Command Action
pnpm install Installs dependencies
pnpm run prepare Install git pre-commit hook
pnpm run dev Starts local dev server at localhost:3000
pnpm run build Build your production site to ./dist/
pnpm run preview Preview your build locally, before deploying
pnpm run format Format codes with Prettier
pnpm run format-staged Format staged files with Prettier
pnpm run lint:eslint Run Eslint
pnpm run astro ... Run CLI commands like astro add, astro preview

See the AstroWind docs for more information.

Format locally

docker run --rm -ti -v $(pwd):$(pwd) -w $(pwd) node:19 bash -c 'corepack enable ; pnpm install --frozen-lockfile ; pnpm run format'