diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..88dbe2b --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,16 @@ +# AI Agent Instructions for gohugo + +## Tagging AI-Involved Content + +When creating or editing Hugo content files under `site/content/`, apply the following tags in the frontmatter: + +- **`AI-gen`** — Add this tag when the article was mostly written by AI (i.e., the majority of the text was generated by an AI agent). +- **`AI-reviewed`** — Add this tag when the article was reviewed, edited, or refined by AI but the original content was primarily human-written. + +These tags go in the `tags` array in the TOML frontmatter. For example: + +```toml +tags = ['some-topic', 'AI-gen'] +``` + +If both apply, include both tags. diff --git a/scripts/new.sh b/scripts/new.sh new file mode 100755 index 0000000..8e67912 --- /dev/null +++ b/scripts/new.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Create a new content page using Hugo's archetype. +# Usage: ./scripts/new.sh +# Example: ./scripts/new.sh content/thissite/my-page.md + +source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../.env" + +if [[ $# -lt 1 ]]; then + echo "Usage: $0 " + echo "Example: $0 content/thissite/my-page.md" + exit 1 +fi + +docker run --rm \ + -v "${SITE_DIR}:/src" \ + -w /src \ + "${HUGO_IMAGE}" new "$1" diff --git a/site/content/thissite/date-test.md b/site/content/thissite/date-test.md new file mode 100644 index 0000000..1c2e5b2 --- /dev/null +++ b/site/content/thissite/date-test.md @@ -0,0 +1,12 @@ ++++ +date = '2026-03-01T10:00:00Z' +draft = false +title = 'Date Test' +tags = ['test', 'AI-gen'] ++++ + +This page was created on March 1, 2026. If the dates are working +correctly, you should see a different "Updated" date — the date +of the most recent git commit that touched this file. + +(Edited on April 3 to verify the updated date changes.) diff --git a/site/content/thissite/dates.md b/site/content/thissite/dates.md index 76dd051..0eb4aa5 100644 --- a/site/content/thissite/dates.md +++ b/site/content/thissite/dates.md @@ -2,21 +2,23 @@ title: "How Dates Work on This Site" date: 2026-04-03 draft: false -tags: ['hugo', 'git', 'workflow'] +tags: ['hugo', 'git', 'workflow', 'AI-gen'] --- -Every page on this site has two dates: **Created** and **Last Modified**. +Every page on this site has two dates: **Created** and **Updated**. Neither one is maintained by hand. Here's the full flow. ## Creating a new page -New content is created via Hugo's CLI (running in Docker): +New content is created with the `new.sh` script: ```bash -docker run --rm -v "${SITE_DIR}:/src" -w /src \ - ghcr.io/gohugoio/hugo:latest new content/thissite/my-page.md +./scripts/new.sh content/thissite/my-page.md ``` +This sources `.env` for `HUGO_IMAGE` and `SITE_DIR`, then runs +`hugo new` inside the Docker container. + Hugo reads the archetype template at `archetypes/default.md`: ```yaml @@ -44,7 +46,7 @@ tags: [] **That `date` value is baked into the file once and never changes.** It represents when the page was created. Nobody edits it afterward. -## How "Last Modified" works +## How "Updated" works The `lastmod` field is **not** stored in the file at all. It's resolved at build time by Hugo based on this config in `hugo.toml`: @@ -72,7 +74,7 @@ then render it with `{{ .Lastmod }}`. ## What does git actually track? Git records the **author date** on each commit. When you edit a file and -commit it, that commit's date becomes the new `lastmod` for that file. +commit it, that commit's date becomes the new updated date for that file. The original `date` in front matter is untouched — it still reflects creation time. @@ -84,7 +86,7 @@ Date: Thu Apr 3 14:30:00 2026 -0400 Fix typo in dates page ``` -Hugo will see `Apr 3 14:30:00 2026` as the `lastmod` for any file +Hugo will see `Apr 3 14:30:00 2026` as the updated date for any file modified in that commit. ## The full lifecycle @@ -101,8 +103,8 @@ modified in that commit. - **Created date**: set once by the archetype, stored in front matter, never changes. -- **Last modified**: not stored in the file. Resolved from git at build +- **Updated date**: not stored in the file. Resolved from git at build time. Zero maintenance. - **`enableGitInfo = true`** is required in `hugo.toml` for any of the git-based date resolution to work. -- **No tracking needed** for `lastmod` — it's derived, not stored. +- **No tracking needed** for the updated date — it's derived, not stored. diff --git a/site/hugo.toml b/site/hugo.toml index 905cdc9..234ff4c 100644 --- a/site/hugo.toml +++ b/site/hugo.toml @@ -14,6 +14,7 @@ enableGitInfo = true [params] contentTypeName = "posts" showMenuItems = 5 + showLastUpdated = true fullWidthTheme = false centerTheme = true