# Blog Starter

This folder is a standalone starter for a Hugo blog that uses the LoveIt theme
and deploys to the static blog host installed by `install.sh`.

## What This Starter Includes

- Hugo site structure
- LoveIt bootstrap script
- sample content
- a helper script to create new posts
- a Forgejo Actions workflow that builds and deploys to `/opt/blog/public`

## Recommended Setup

Create a separate Git repository for your blog, then copy this starter into that
repository root.

## Local Writing Workflow

1. Bootstrap the theme:

```bash
./scripts/bootstrap-theme.sh
```

2. Create a new post:

```bash
./scripts/new-post.sh my-first-post
```

3. Start the local preview server:

```bash
hugo server
```

4. Edit the generated file under `content/posts/`.
5. When ready to publish, set `draft = false`, commit, and push.

## Forgejo Web Workflow

If you want to create posts directly from the Forgejo web UI, use the manual
workflow in `.forgejo/workflows/create-post.yml`.

From the Actions page:

1. Run `Create Blog Post`
2. Fill in:
   - `title`
   - `slug`
   - optional `summary`
   - optional comma-separated `tags`
   - optional comma-separated `categories`
   - `draft`
3. The workflow creates `content/posts/<slug>.md`
4. The normal deploy workflow publishes the post on the next push

This keeps you out of front matter for most day-to-day writing.

## Forgejo Secrets

The workflow expects these repository secrets:

- `BLOG_DEPLOY_HOST`: server hostname or IP
- `BLOG_DEPLOY_PORT`: SSH port, usually `22`
- `BLOG_DEPLOY_USER`: deploy user on the server
- `BLOG_DEPLOY_KEY`: private SSH key for the deploy user
- `BLOG_DEPLOY_PATH`: target directory, usually `/opt/blog`
- `BLOG_DEPLOY_KNOWN_HOSTS`: optional `known_hosts` entry for stricter SSH

## Expected Server State

- Blog host installed from this repo's `install.sh`
- `d3v-blog` container running
- a deploy user created by `install.sh blog-install` or `install.sh blog-update`
- `install.sh blog-deploy-info` prints the exact secret values to paste into Forgejo
- Nginx Proxy Manager forwards `blog.yourdomain.com` to `d3v-blog:80`

## Notes

- This starter fetches LoveIt into `themes/LoveIt` using Git.
- The workflow installs Hugo Extended before building.
- Deployment uses `rsync --delete` to keep `/opt/blog/public` in sync with the
  latest generated `public/` output.
