Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pythoninthegrass/hello_hugo
Boilerplate for hugo static site with custom css/js
https://github.com/pythoninthegrass/hello_hugo
docker golang hugo nginx taskfile webdev
Last synced: 28 days ago
JSON representation
Boilerplate for hugo static site with custom css/js
- Host: GitHub
- URL: https://github.com/pythoninthegrass/hello_hugo
- Owner: pythoninthegrass
- License: unlicense
- Created: 2024-07-24T17:22:05.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-07-30T19:38:08.000Z (3 months ago)
- Last Synced: 2024-09-27T17:04:18.865Z (about 1 month ago)
- Topics: docker, golang, hugo, nginx, taskfile, webdev
- Language: Dockerfile
- Homepage:
- Size: 34.2 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hello_hugo
Absolute minimum to scaffold a Hugo static site with a [custom theme](https://gohugo.io/getting-started/quick-start/).
(With some dev tooling added after the fact 😈)
## Minimum Requirements
* macOS or Linux
* [Hugo](https://gohugo.io/getting-started/installing/)
* Linux: ignore package manager / snap packages, download latest [GitHub release](https://github.com/gohugoio/hugo/releases/)
* Make sure to get the extended version (e.g., `hugo_extended_0.129.0_linux-amd64.tar.gz`)## Recommended Requirements
* [taskfile](https://taskfile.dev/#/installation)
* [devbox](https://www.jetify.com/devbox/docs/quickstart/)## Quickstart
```bash
# clone repo
git clone https://github.com/pythoninthegrass/hello_hugo.git
cd hello_hugo# clone theme submodule
[ $(uname -s) == "Darwin" ] && procs=$(sysctl -n hw.ncpu) || procs=$(nproc)
git submodule update --init --recursive && git pull --recurse-submodules -j"${procs}"# add a new post
hugo new posts/test-post.md# start hugo server (with hot reloading)
hugo server# open browser to http://localhost:1313
# stop hugo server
# CTRL+C
```## Customize
### Fill out `.env` file
Programmatically generate the [hugo.toml](hugo.toml) via `python` and `devbox`.
Minimum values in `.env`:
| Key | Default Value |
| ---------- | --------------- |
| `BASE_URL` | `example.com` |
| `LANGUAGE` | `en-us` |
| `TITLE` | `Hello, World!` |
| `THEME` | `ananke` |### Generate `hugo.toml`
```bash
devbox install
cp .env.example .env
# edit .env
devbox run gen-config
```### Build
```bash
hugo
```## Nginx + Docker
If deploying to `nginx`, add the following to `.env`:
| Key | Default Value |
| ----------- | ----------------- |
| `NGINX_DIR` | `` |where `` is the path to the `nginx` root directory.
### HTTP (Port 80)
Comment out the line in [docker-compose.yml](docker-compose.yml) that mounts the `nginx` [certs](nginx/certs) directory.
```yaml
volumes:
- ./public:/var/www/public
# - ./nginx/certs:/etc/acme/certs/live/${BASE_URL}
```### HTTPS (Port 443)
Generate certificates with either [acme.sh](https://github.com/acmesh-official/acme.sh) or [certbot](https://certbot.eff.org/).
Copy the following files to the `nginx` [certs](nginx/certs) directory:
* `fullchain.pem`
* `privkey.pem`
* `ssl-dhparams.pem`If developing locally, add the following to `/etc/hosts`:
```bash
127.0.0.1 example.com
# 127.0.0.1 localhost
```Where `example.com` is the value of `BASE_URL` in `.env`.
Remember to revert / comment out the `127.0.0.1 example.com` line and reinstate `127.0.0.1 localhost` when done.
### Both HTTP and HTTPS
Build and start the `nginx` container:
```bash
docker compose up -d --build
```Navigate to the `BASE_URL` in a browser:
* `http://example.com`
* `https://example.com`## TODO
* [Issues](https://github.com/pythoninthegrass/hello_hugo/issues)