www/README.md

83 lines
2.6 KiB
Markdown

# Sources for www.distribits.live
This is a [hugo](https://gohugo.io) project, meaning that the online website
is built from the content of this repository using a static website generator.
This repository is also a [DataLad](https://datalad.org) dataset and
[git-annex](https://git-annex.branchable.com) repository.
## Edit and test the website locally
In order to work on the website locally and independently clone this dataset
and run `hugo` to serve a website draft on your own computer. The following
command achieve that.
With DataLad installed, do the following:
```sh
datalad clone ssh://git@hub.datalad.org/distribits/www.git www.distribits.live
# and enter the directory for any of the following commands to work
cd www.distribits.live
```
This created a clone of the dataset in the directory `www.distribits.live`.
Now obtain the website theme. It provides the website "looks" and is only
needed for actually rendering the site, but not for making edits.
The next command downloads the theme and all media files.
This requires an SSH account on `hub.datalad.org`. Contact
mih@ngln.eu to obtain one.
```
datalad get -r .
```
Now you are ready to run hugo. It will build the site and output a URL to
open in a browser to test it.
```
hugo server
```
Make any edits, test them out locally, then save and push them with
`datalad push`
## Adding media files
Media files (images, videos, etc) should not be added directly to the Git
repository to avoid bloat and the resulting technical difficulties of
maintaining the website.
Instead, media files are added to the repository's annex with DataLad or
git-annex. A `datalad save -m "<message>"` to save an update will do the right
thing automatically. If you are using Git directly, instead of using `git add
<file>` use `git annex add <file>` and afterwards commit normally.
## Repository organization
There are two primary branches
- `main`
- `published`
The first is the development branch. Deployments target a draft site. The
`published` branch reflect the latest deployment of the official website.
Changes are merged from `main` to `published`, never the other way round.
## Deploy
A website update can be deployed by running the `deploy.sh` script in the
root of the repository. Depending on the branch that is deployed, it will
either update https://www-draft.distribits.live or the official website
at https://www.distribits.live.
SSH-access permissions are required for deploying an update.
## hugo vs git-annex
Hugo cannot deal with symlinks, seemingly not at all. Hence, this repository is set up with
git annex config --set annex.addunlocked true
to avoid any issues with annexed files.