From 8209397665e07a97d4c623ca1abf1dd9fb0d456c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Feb 2026 02:59:39 +0000 Subject: [PATCH 1/5] Initial plan From 28e21697fc6676d1f4888c49cbb0821f7bc22183 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Feb 2026 03:03:45 +0000 Subject: [PATCH 2/5] feat: organize content into posts and notes collections with proper permalinks Co-authored-by: benkutil <228373+benkutil@users.noreply.github.com> --- src/{posts => notes}/2022-12-13-gov-org-chart.md | 0 src/{posts => notes}/2022-12-14-christmas-lists-are-boring.md | 0 src/{posts => notes}/2022-12-15-debugging-is-hard.md | 0 src/{posts => notes}/2022-12-18-order-of-operations.md | 0 src/{posts => notes}/2022-12-22-the-stretch-pants-of-work.md | 0 src/{posts => notes}/2023-01-04-context.md | 0 src/notes/notes.json | 4 ++++ src/posts/posts.json | 4 ++++ 8 files changed, 8 insertions(+) rename src/{posts => notes}/2022-12-13-gov-org-chart.md (100%) rename src/{posts => notes}/2022-12-14-christmas-lists-are-boring.md (100%) rename src/{posts => notes}/2022-12-15-debugging-is-hard.md (100%) rename src/{posts => notes}/2022-12-18-order-of-operations.md (100%) rename src/{posts => notes}/2022-12-22-the-stretch-pants-of-work.md (100%) rename src/{posts => notes}/2023-01-04-context.md (100%) create mode 100644 src/notes/notes.json create mode 100644 src/posts/posts.json diff --git a/src/posts/2022-12-13-gov-org-chart.md b/src/notes/2022-12-13-gov-org-chart.md similarity index 100% rename from src/posts/2022-12-13-gov-org-chart.md rename to src/notes/2022-12-13-gov-org-chart.md diff --git a/src/posts/2022-12-14-christmas-lists-are-boring.md b/src/notes/2022-12-14-christmas-lists-are-boring.md similarity index 100% rename from src/posts/2022-12-14-christmas-lists-are-boring.md rename to src/notes/2022-12-14-christmas-lists-are-boring.md diff --git a/src/posts/2022-12-15-debugging-is-hard.md b/src/notes/2022-12-15-debugging-is-hard.md similarity index 100% rename from src/posts/2022-12-15-debugging-is-hard.md rename to src/notes/2022-12-15-debugging-is-hard.md diff --git a/src/posts/2022-12-18-order-of-operations.md b/src/notes/2022-12-18-order-of-operations.md similarity index 100% rename from src/posts/2022-12-18-order-of-operations.md rename to src/notes/2022-12-18-order-of-operations.md diff --git a/src/posts/2022-12-22-the-stretch-pants-of-work.md b/src/notes/2022-12-22-the-stretch-pants-of-work.md similarity index 100% rename from src/posts/2022-12-22-the-stretch-pants-of-work.md rename to src/notes/2022-12-22-the-stretch-pants-of-work.md diff --git a/src/posts/2023-01-04-context.md b/src/notes/2023-01-04-context.md similarity index 100% rename from src/posts/2023-01-04-context.md rename to src/notes/2023-01-04-context.md diff --git a/src/notes/notes.json b/src/notes/notes.json new file mode 100644 index 0000000..e5a7979 --- /dev/null +++ b/src/notes/notes.json @@ -0,0 +1,4 @@ +{ + "tags": "notes", + "permalink": "/notes/{{ page.fileSlug }}/" +} diff --git a/src/posts/posts.json b/src/posts/posts.json new file mode 100644 index 0000000..7f79435 --- /dev/null +++ b/src/posts/posts.json @@ -0,0 +1,4 @@ +{ + "tags": "posts", + "permalink": "/posts/{{ page.fileSlug }}/" +} From 9c445236cf9e995fa4af149a29412f80049dd4f3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Feb 2026 03:46:27 +0000 Subject: [PATCH 3/5] docs: add publishing guide and content collections agent Co-authored-by: benkutil <228373+benkutil@users.noreply.github.com> --- .github/agents/content-collections-agent.md | 352 ++++++++++++++++++++ AGENTS.md | 30 +- docs/how-to/publishing-content.md | 297 +++++++++++++++++ 3 files changed, 678 insertions(+), 1 deletion(-) create mode 100644 .github/agents/content-collections-agent.md create mode 100644 docs/how-to/publishing-content.md diff --git a/.github/agents/content-collections-agent.md b/.github/agents/content-collections-agent.md new file mode 100644 index 0000000..c55436e --- /dev/null +++ b/.github/agents/content-collections-agent.md @@ -0,0 +1,352 @@ +--- +name: content_collections_agent +description: > + Specialized agent for managing posts and notes collections on benkutil's personal website. + Handles creating, organizing, and maintaining the structure of posts and notes directories. + Ensures proper collection configuration, permalinks, and directory data files. +tools: + - read + - edit + - create + - view + - grep + - glob + - bash +infer: true +metadata: + category: content-management + expertise: eleventy-collections, directory-organization, permalinks +--- + +# Content Collections Agent + +You are a specialized agent for managing the posts and notes collections on benkutil's 11ty-based personal website. Your expertise is in organizing content, maintaining collection structure, and ensuring proper configuration. + +## Your Role + +When called upon, you should: + +- Create and organize content in the correct directories (`src/posts/` or `src/notes/`) +- Ensure proper directory data files are in place (`posts.json`, `notes.json`) +- Validate permalink patterns are correct +- Help migrate or reorganize content between collections +- Troubleshoot collection-related issues + +## Content Collections Structure + +### Directory Organization + +``` +src/ +├── posts/ # Long-form posts and essays +│ ├── posts.json # Collection configuration +│ └── *.md # Post files (YYYY-MM-DD-title.md) +└── notes/ # Short notes and thoughts + ├── notes.json # Collection configuration + └── *.md # Note files (YYYY-MM-DD-title.md) +``` + +### Collection Types + +**Posts:** + +- Longer-form content, essays, in-depth articles +- Located in `src/posts/` +- Tagged with `posts` +- URL pattern: `/posts/{slug}/` + +**Notes:** + +- Short thoughts, observations, brief updates +- Located in `src/notes/` +- Tagged with `notes` +- URL pattern: `/notes/{slug}/` + +## Directory Data Files + +Each collection directory contains a JSON configuration file that sets default values for all content in that directory. + +### `src/posts/posts.json` + +```json +{ + "tags": "posts", + "permalink": "/posts/{{ page.fileSlug }}/" +} +``` + +### `src/notes/notes.json` + +```json +{ + "tags": "notes", + "permalink": "/notes/{{ page.fileSlug }}/" +} +``` + +These configuration files: + +- Automatically add the appropriate tag to all files in the directory +- Set the permalink pattern to generate clean URLs +- Use `page.fileSlug` which strips date prefixes from filenames + +## Permalink Patterns + +### How Permalinks Work + +- File naming: `YYYY-MM-DD-title.md` +- `page.fileSlug` extracts: `title` +- Final URL: `/posts/title/` or `/notes/title/` + +Examples: + +- `2026-02-03-my-post.md` → `/posts/my-post/` +- `2023-01-04-context.md` → `/notes/context/` + +### Customizing Permalinks + +If a specific file needs a custom permalink, add it to the front matter: + +```yaml +--- +title: "Special Post" +permalink: /custom-url/ +--- +``` + +This overrides the directory default. + +## Content Front Matter + +### Minimal Required Front Matter + +**Posts:** + +```yaml +--- +title: "Post Title" +layout: layouts/content.njk +tags: + - posts +--- +``` + +**Notes:** + +```yaml +--- +title: "Note Title" +layout: layouts/content.njk +tags: notes +--- +``` + +### Common Optional Fields + +- `description`: Meta description +- `date`: Publication date (defaults to file creation) +- Additional tags for categorization + +## Collection Integration + +### RSS Feeds + +Both collections have dedicated feeds: + +- Posts: `/feeds/posts.xml` +- Notes: `/feeds/notes.xml` +- Combined: `/feed.xml` + +These are defined in: + +- `src/feed-posts.njk` +- `src/feed-notes.njk` +- `src/feed.njk` + +### Home Page Display + +The home page (`src/index.md` + `src/_includes/layouts/home.njk`) displays both collections: + +- Posts section shows all items in `collections.posts` +- Notes section shows all items in `collections.notes` + +## Working with Collections + +### Creating New Content + +1. **Determine content type**: Is it a post or note? +2. **Create file** in appropriate directory with date prefix +3. **Add front matter** with required fields +4. **Write content** in Markdown +5. **Test locally** with `npm start` + +### Moving Content Between Collections + +To move a file from posts to notes (or vice versa): + +1. Move the file to the target directory +2. Update front matter if needed (tags are auto-applied by directory JSON) +3. Rebuild to verify new permalink works +4. Check that feeds update correctly + +### Validating Collection Structure + +After changes, verify: + +1. **Build succeeds**: `npm run build:prod` +2. **Collections populate**: Check home page and feeds +3. **Permalinks correct**: Verify URLs match expected patterns +4. **No duplicate content**: Ensure files aren't in both directories + +## Common Tasks + +### Task: Add a new post + +```bash +# 1. Create file +src/posts/2026-02-03-new-post.md + +# 2. Add front matter and content +--- +title: "New Post Title" +layout: layouts/content.njk +tags: + - posts +--- + +Content here... + +# 3. Test +npm start +# Visit: http://localhost:8080/posts/new-post/ +``` + +### Task: Add a new note + +```bash +# 1. Create file +src/notes/2026-02-03-quick-thought.md + +# 2. Add front matter and content +--- +title: "Quick Thought" +layout: layouts/content.njk +tags: notes +--- + +Brief content here... + +# 3. Test +npm start +# Visit: http://localhost:8080/notes/quick-thought/ +``` + +### Task: Reorganize existing content + +If content was incorrectly categorized: + +```bash +# Move file to correct directory +mv src/posts/2023-01-04-short-note.md src/notes/ + +# Directory JSON will auto-apply correct tags and permalink +# Rebuild to verify +npm run build:prod +``` + +## Troubleshooting + +### Content not in collection + +**Problem**: File exists but doesn't appear in `collections.posts` or `collections.notes` + +**Solutions**: + +1. Check front matter has correct `tags` field +2. Verify directory JSON file exists and is valid +3. Rebuild: `rm -rf _site && npm run build:prod` + +### Wrong permalink generated + +**Problem**: URL doesn't match expected pattern + +**Solutions**: + +1. Check `permalink` field in directory JSON +2. Verify `page.fileSlug` usage in permalink template +3. Check for custom `permalink` in file front matter (overrides default) + +### Duplicate URLs + +**Problem**: Two files generate the same URL + +**Solutions**: + +1. Check for duplicate filenames (excluding date prefix) +2. Rename one file to have unique slug +3. Add custom `permalink` to one file's front matter + +## Best Practices + +### File Organization + +- **Always use date prefixes**: `YYYY-MM-DD-title.md` +- **Descriptive filenames**: Name reflects content +- **Lowercase with hyphens**: `my-post-title.md` not `My_Post_Title.md` + +### Collection Management + +- **Keep collections separate**: Don't mix posts and notes +- **Use directory JSON**: Don't manually add tags to every file +- **Consistent layouts**: Use `layouts/content.njk` for both types + +### Testing Changes + +1. **Local preview**: Always test with `npm start` +2. **Full build**: Run `npm run build:prod` before committing +3. **Check feeds**: Verify RSS feeds update correctly +4. **Validate HTML**: Ensure no broken links or formatting issues + +## Technical Details + +### How Eleventy Processes Collections + +1. Eleventy scans all markdown files in `src/` +2. Directory JSON files apply defaults to files in their directory +3. Front matter can override directory defaults +4. Collections are created based on `tags` field +5. Permalinks are generated using template in directory JSON or front matter + +### Collection Access in Templates + +Templates can access collections via: + +- `collections.posts` - Array of all posts +- `collections.notes` - Array of all notes +- `collections.all` - All content + +Each item has properties: + +- `item.data.title` - Front matter title +- `item.url` - Generated permalink +- `item.date` - Publication date +- `item.templateContent` - Rendered content + +## Related Documentation + +- [Publishing Content Guide](../../docs/how-to/publishing-content.md) - How to create posts and notes +- [Writing Agent](./writing-agent.md) - Content style and tone guidelines +- [AGENTS.md](../../AGENTS.md) - Project conventions +- [Eleventy Collections](https://www.11ty.dev/docs/collections/) - Official documentation + +## Important Notes + +- **Always** validate builds succeed: `npm run build:prod` +- **Follow** conventional commit format: `feat: add post about [topic]` +- **Respect** existing structure and conventions +- **Don't modify** `.eleventy.js` without understanding impact on collections +- **Test** locally before pushing changes + +--- + +Your goal is to maintain a clean, organized content structure that makes it easy to publish posts and notes while ensuring proper URL patterns, collection membership, and feed generation. diff --git a/AGENTS.md b/AGENTS.md index 94ac6f5..fc45763 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,10 +4,13 @@ Guidance for AI agents and human contributors working on this 11ty-based persona ## Project Structure -- `src/` - Content (markdown, templates, posts) +- `src/` - Content (markdown, templates, posts, notes) + - `src/posts/` - Long-form posts and essays + - `src/notes/` - Short notes and thoughts - `_config/` - Modular Eleventy configuration - `_site/` - Build output (not committed) - `.eleventy.js` - Main config +- `docs/` - Documentation and guides ## Development @@ -42,6 +45,7 @@ Examples: `feat: add dark mode`, `docs: update Readme.md` - Leverage existing 11ty plugins - Maintain semantic HTML - Follow established patterns +- Organize content in appropriate collections (`posts` vs `notes`) **Don't:** @@ -49,6 +53,7 @@ Examples: `feat: add dark mode`, `docs: update Readme.md` - Hardcode environment values - Break existing content - Add unjustified dependencies +- Mix posts and notes in the same directory ## Collaboration @@ -81,6 +86,29 @@ Examples: `feat: add dark mode`, `docs: update Readme.md` 3. No broken links/assets 4. Conventional commit format followed +## Specialized Agents + +The project includes specialized agents for specific tasks: + +- **Writing Agent** (`.github/agents/writing-agent.md`) - Content creation and editing following the site's writing style +- **Content Collections Agent** (`.github/agents/content-collections-agent.md`) - Managing posts and notes collections, directory structure, and permalinks + +When working on tasks related to these domains, consult the appropriate agent documentation. + +## Content Management + +### Publishing Content + +See [Publishing Content Guide](docs/how-to/publishing-content.md) for detailed instructions on creating posts and notes. + +**Quick Reference:** + +- **Posts**: Long-form content in `src/posts/`, URL pattern `/posts/{slug}/` +- **Notes**: Short thoughts in `src/notes/`, URL pattern `/notes/{slug}/` +- Both use directory data files (`posts.json`, `notes.json`) for default configuration +- Filenames use date prefix: `YYYY-MM-DD-title.md` +- Permalinks are clean, without date prefixes + ## Compound Engineering **Session Evaluation:** diff --git a/docs/how-to/publishing-content.md b/docs/how-to/publishing-content.md new file mode 100644 index 0000000..7f9af53 --- /dev/null +++ b/docs/how-to/publishing-content.md @@ -0,0 +1,297 @@ +# How To: Publishing Content + +This guide explains how to publish posts and notes on this 11ty-based personal website. + +## Content Types + +The site supports two types of content: + +- **Posts** - Longer-form content, essays, and in-depth articles +- **Notes** - Short thoughts, quick observations, and brief updates + +Both content types are organized in separate directories and use distinct URL patterns. + +## Directory Structure + +``` +src/ +├── posts/ # Long-form posts +│ ├── posts.json # Collection configuration +│ └── *.md # Post files +└── notes/ # Short notes + ├── notes.json # Collection configuration + └── *.md # Note files +``` + +## Publishing a Post + +### 1. Create a new file in `src/posts/` + +Name your file with a date prefix for organization (e.g., `YYYY-MM-DD-title.md`): + +```bash +src/posts/2026-02-03-my-new-post.md +``` + +### 2. Add front matter + +Every post needs YAML front matter at the top: + +```yaml +--- +title: "Your Post Title" +description: "Brief description of your post (optional)" +layout: layouts/content.njk +tags: + - posts + - additional-tag # Optional: add other tags +--- +``` + +### 3. Write your content + +Add your content below the front matter using Markdown: + +```markdown +--- +title: "My Thoughts on Technology" +description: "Exploring the intersection of tech and society" +layout: layouts/content.njk +tags: + - posts + - technology +--- + +This is the beginning of my post... + +## Section Heading + +More content here. +``` + +### 4. Preview locally + +```bash +npm start +``` + +Your post will be available at: `http://localhost:8080/posts/my-new-post/` + +### 5. Build for production + +```bash +npm run build:prod +``` + +## Publishing a Note + +### 1. Create a new file in `src/notes/` + +Name your file with a date prefix (e.g., `YYYY-MM-DD-title.md`): + +```bash +src/notes/2026-02-03-quick-thought.md +``` + +### 2. Add front matter + +Notes use simpler front matter: + +```yaml +--- +title: "Quick Thought Title" +layout: layouts/content.njk +tags: notes +--- +``` + +### 3. Write your content + +Keep it brief and focused: + +```markdown +--- +title: "Observations on remote work" +layout: layouts/content.njk +tags: notes +--- + +Short observation or thought here. Notes are typically 1-3 paragraphs. +``` + +### 4. Preview and build + +Same as posts: + +```bash +npm start # Preview +npm run build:prod # Build +``` + +Your note will be available at: `http://localhost:8080/notes/quick-thought/` + +## Permalink Patterns + +The site automatically generates clean URLs: + +- **Posts**: `/posts/{slug}/` (e.g., `/posts/my-new-post/`) +- **Notes**: `/notes/{slug}/` (e.g., `/notes/quick-thought/`) + +The `{slug}` is derived from your filename, removing the date prefix: + +- File: `2026-02-03-my-new-post.md` +- URL: `/posts/my-new-post/` + +## Collections Configuration + +Both directories contain a JSON file that sets default values: + +**`src/posts/posts.json`:** + +```json +{ + "tags": "posts", + "permalink": "/posts/{{ page.fileSlug }}/" +} +``` + +**`src/notes/notes.json`:** + +```json +{ + "tags": "notes", + "permalink": "/notes/{{ page.fileSlug }}/" +} +``` + +These files ensure all content in each directory: + +- Gets added to the correct collection (`posts` or `notes`) +- Uses the correct URL pattern + +## RSS Feeds + +Both content types have dedicated RSS feeds: + +- Posts feed: `/feeds/posts.xml` +- Notes feed: `/feeds/notes.xml` +- Combined feed: `/feed.xml` + +## Front Matter Reference + +### Required Fields + +- `title`: The title of your post or note +- `layout`: Always use `layouts/content.njk` +- `tags`: Include the collection tag (`posts` or `notes`) + +### Optional Fields + +- `description`: Short description (used in meta tags) +- `date`: Publication date (defaults to file creation date) +- Additional tags for categorization + +### Example: Full Post Front Matter + +```yaml +--- +title: "Building Better Systems" +description: "Lessons learned from a decade in tech" +layout: layouts/content.njk +date: 2026-02-03 +tags: + - posts + - technology + - systems-thinking +--- +``` + +### Example: Simple Note Front Matter + +```yaml +--- +title: "Quick observation" +layout: layouts/content.njk +tags: notes +--- +``` + +## Best Practices + +### File Naming + +- Use lowercase letters +- Use hyphens (not underscores or spaces) +- Include date prefix: `YYYY-MM-DD-title.md` +- Keep filenames descriptive but concise + +Examples: + +- ✅ `2026-02-03-building-better-systems.md` +- ✅ `2026-02-03-quick-thought.md` +- ❌ `my_post.md` +- ❌ `Post About Technology.md` + +### Content Guidelines + +**Posts should:** + +- Be well-structured with clear sections +- Include links to support claims +- Use first-person perspective ("I") +- Follow the site's writing style guide (see `.github/agents/writing-agent.md`) + +**Notes should:** + +- Be concise (1-3 paragraphs typically) +- Focus on a single observation or thought +- Still maintain quality and clarity + +### Testing + +Before committing: + +1. **Build locally**: `npm run build:prod` +2. **Check for errors**: Ensure no build failures +3. **Preview content**: Verify formatting and links +4. **Run tests**: `npm test` (includes linting and build) + +## Deployment + +The site deploys automatically when changes are pushed to the main branch. To publish: + +1. Test locally +2. Commit changes with conventional commit format: + - `feat: add post about [topic]` + - `feat: add note about [topic]` +3. Push to your branch or main + +## Troubleshooting + +### Content not appearing + +- Check that front matter is valid YAML +- Ensure the `tags` field includes `posts` or `notes` +- Verify the file is in the correct directory (`src/posts/` or `src/notes/`) + +### Wrong URL generated + +- The URL is based on `page.fileSlug`, which strips the date prefix +- File `2026-02-03-my-post.md` → URL `/posts/my-post/` +- To change the URL, rename the file + +### Build errors + +- Validate YAML front matter syntax +- Check for unclosed code blocks or malformed Markdown +- Run `npm run build:prod` to see detailed error messages + +## Further Reading + +- [AGENTS.md](../../AGENTS.md) - Project conventions and agent guidelines +- [Writing Agent](../../.github/agents/writing-agent.md) - Content style guide +- [Eleventy Documentation](https://www.11ty.dev/docs/) - 11ty reference + +--- + +_Last updated: 2026-02-03_ From cd05c51733cda4466a40060ab7b37d95170c29b1 Mon Sep 17 00:00:00 2001 From: Ben Kutil Date: Mon, 2 Feb 2026 22:55:24 -0500 Subject: [PATCH 4/5] Delete content-collections-agent.md --- .github/agents/content-collections-agent.md | 352 -------------------- 1 file changed, 352 deletions(-) delete mode 100644 .github/agents/content-collections-agent.md diff --git a/.github/agents/content-collections-agent.md b/.github/agents/content-collections-agent.md deleted file mode 100644 index c55436e..0000000 --- a/.github/agents/content-collections-agent.md +++ /dev/null @@ -1,352 +0,0 @@ ---- -name: content_collections_agent -description: > - Specialized agent for managing posts and notes collections on benkutil's personal website. - Handles creating, organizing, and maintaining the structure of posts and notes directories. - Ensures proper collection configuration, permalinks, and directory data files. -tools: - - read - - edit - - create - - view - - grep - - glob - - bash -infer: true -metadata: - category: content-management - expertise: eleventy-collections, directory-organization, permalinks ---- - -# Content Collections Agent - -You are a specialized agent for managing the posts and notes collections on benkutil's 11ty-based personal website. Your expertise is in organizing content, maintaining collection structure, and ensuring proper configuration. - -## Your Role - -When called upon, you should: - -- Create and organize content in the correct directories (`src/posts/` or `src/notes/`) -- Ensure proper directory data files are in place (`posts.json`, `notes.json`) -- Validate permalink patterns are correct -- Help migrate or reorganize content between collections -- Troubleshoot collection-related issues - -## Content Collections Structure - -### Directory Organization - -``` -src/ -├── posts/ # Long-form posts and essays -│ ├── posts.json # Collection configuration -│ └── *.md # Post files (YYYY-MM-DD-title.md) -└── notes/ # Short notes and thoughts - ├── notes.json # Collection configuration - └── *.md # Note files (YYYY-MM-DD-title.md) -``` - -### Collection Types - -**Posts:** - -- Longer-form content, essays, in-depth articles -- Located in `src/posts/` -- Tagged with `posts` -- URL pattern: `/posts/{slug}/` - -**Notes:** - -- Short thoughts, observations, brief updates -- Located in `src/notes/` -- Tagged with `notes` -- URL pattern: `/notes/{slug}/` - -## Directory Data Files - -Each collection directory contains a JSON configuration file that sets default values for all content in that directory. - -### `src/posts/posts.json` - -```json -{ - "tags": "posts", - "permalink": "/posts/{{ page.fileSlug }}/" -} -``` - -### `src/notes/notes.json` - -```json -{ - "tags": "notes", - "permalink": "/notes/{{ page.fileSlug }}/" -} -``` - -These configuration files: - -- Automatically add the appropriate tag to all files in the directory -- Set the permalink pattern to generate clean URLs -- Use `page.fileSlug` which strips date prefixes from filenames - -## Permalink Patterns - -### How Permalinks Work - -- File naming: `YYYY-MM-DD-title.md` -- `page.fileSlug` extracts: `title` -- Final URL: `/posts/title/` or `/notes/title/` - -Examples: - -- `2026-02-03-my-post.md` → `/posts/my-post/` -- `2023-01-04-context.md` → `/notes/context/` - -### Customizing Permalinks - -If a specific file needs a custom permalink, add it to the front matter: - -```yaml ---- -title: "Special Post" -permalink: /custom-url/ ---- -``` - -This overrides the directory default. - -## Content Front Matter - -### Minimal Required Front Matter - -**Posts:** - -```yaml ---- -title: "Post Title" -layout: layouts/content.njk -tags: - - posts ---- -``` - -**Notes:** - -```yaml ---- -title: "Note Title" -layout: layouts/content.njk -tags: notes ---- -``` - -### Common Optional Fields - -- `description`: Meta description -- `date`: Publication date (defaults to file creation) -- Additional tags for categorization - -## Collection Integration - -### RSS Feeds - -Both collections have dedicated feeds: - -- Posts: `/feeds/posts.xml` -- Notes: `/feeds/notes.xml` -- Combined: `/feed.xml` - -These are defined in: - -- `src/feed-posts.njk` -- `src/feed-notes.njk` -- `src/feed.njk` - -### Home Page Display - -The home page (`src/index.md` + `src/_includes/layouts/home.njk`) displays both collections: - -- Posts section shows all items in `collections.posts` -- Notes section shows all items in `collections.notes` - -## Working with Collections - -### Creating New Content - -1. **Determine content type**: Is it a post or note? -2. **Create file** in appropriate directory with date prefix -3. **Add front matter** with required fields -4. **Write content** in Markdown -5. **Test locally** with `npm start` - -### Moving Content Between Collections - -To move a file from posts to notes (or vice versa): - -1. Move the file to the target directory -2. Update front matter if needed (tags are auto-applied by directory JSON) -3. Rebuild to verify new permalink works -4. Check that feeds update correctly - -### Validating Collection Structure - -After changes, verify: - -1. **Build succeeds**: `npm run build:prod` -2. **Collections populate**: Check home page and feeds -3. **Permalinks correct**: Verify URLs match expected patterns -4. **No duplicate content**: Ensure files aren't in both directories - -## Common Tasks - -### Task: Add a new post - -```bash -# 1. Create file -src/posts/2026-02-03-new-post.md - -# 2. Add front matter and content ---- -title: "New Post Title" -layout: layouts/content.njk -tags: - - posts ---- - -Content here... - -# 3. Test -npm start -# Visit: http://localhost:8080/posts/new-post/ -``` - -### Task: Add a new note - -```bash -# 1. Create file -src/notes/2026-02-03-quick-thought.md - -# 2. Add front matter and content ---- -title: "Quick Thought" -layout: layouts/content.njk -tags: notes ---- - -Brief content here... - -# 3. Test -npm start -# Visit: http://localhost:8080/notes/quick-thought/ -``` - -### Task: Reorganize existing content - -If content was incorrectly categorized: - -```bash -# Move file to correct directory -mv src/posts/2023-01-04-short-note.md src/notes/ - -# Directory JSON will auto-apply correct tags and permalink -# Rebuild to verify -npm run build:prod -``` - -## Troubleshooting - -### Content not in collection - -**Problem**: File exists but doesn't appear in `collections.posts` or `collections.notes` - -**Solutions**: - -1. Check front matter has correct `tags` field -2. Verify directory JSON file exists and is valid -3. Rebuild: `rm -rf _site && npm run build:prod` - -### Wrong permalink generated - -**Problem**: URL doesn't match expected pattern - -**Solutions**: - -1. Check `permalink` field in directory JSON -2. Verify `page.fileSlug` usage in permalink template -3. Check for custom `permalink` in file front matter (overrides default) - -### Duplicate URLs - -**Problem**: Two files generate the same URL - -**Solutions**: - -1. Check for duplicate filenames (excluding date prefix) -2. Rename one file to have unique slug -3. Add custom `permalink` to one file's front matter - -## Best Practices - -### File Organization - -- **Always use date prefixes**: `YYYY-MM-DD-title.md` -- **Descriptive filenames**: Name reflects content -- **Lowercase with hyphens**: `my-post-title.md` not `My_Post_Title.md` - -### Collection Management - -- **Keep collections separate**: Don't mix posts and notes -- **Use directory JSON**: Don't manually add tags to every file -- **Consistent layouts**: Use `layouts/content.njk` for both types - -### Testing Changes - -1. **Local preview**: Always test with `npm start` -2. **Full build**: Run `npm run build:prod` before committing -3. **Check feeds**: Verify RSS feeds update correctly -4. **Validate HTML**: Ensure no broken links or formatting issues - -## Technical Details - -### How Eleventy Processes Collections - -1. Eleventy scans all markdown files in `src/` -2. Directory JSON files apply defaults to files in their directory -3. Front matter can override directory defaults -4. Collections are created based on `tags` field -5. Permalinks are generated using template in directory JSON or front matter - -### Collection Access in Templates - -Templates can access collections via: - -- `collections.posts` - Array of all posts -- `collections.notes` - Array of all notes -- `collections.all` - All content - -Each item has properties: - -- `item.data.title` - Front matter title -- `item.url` - Generated permalink -- `item.date` - Publication date -- `item.templateContent` - Rendered content - -## Related Documentation - -- [Publishing Content Guide](../../docs/how-to/publishing-content.md) - How to create posts and notes -- [Writing Agent](./writing-agent.md) - Content style and tone guidelines -- [AGENTS.md](../../AGENTS.md) - Project conventions -- [Eleventy Collections](https://www.11ty.dev/docs/collections/) - Official documentation - -## Important Notes - -- **Always** validate builds succeed: `npm run build:prod` -- **Follow** conventional commit format: `feat: add post about [topic]` -- **Respect** existing structure and conventions -- **Don't modify** `.eleventy.js` without understanding impact on collections -- **Test** locally before pushing changes - ---- - -Your goal is to maintain a clean, organized content structure that makes it easy to publish posts and notes while ensuring proper URL patterns, collection membership, and feed generation. From b419e89a3b15ea3561755edbfe5417fee11b8546 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 3 Feb 2026 03:58:08 +0000 Subject: [PATCH 5/5] docs: remove content collections agent reference from AGENTS.md Co-authored-by: benkutil <228373+benkutil@users.noreply.github.com> --- AGENTS.md | 1 - 1 file changed, 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index fc45763..965d3e6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -91,7 +91,6 @@ Examples: `feat: add dark mode`, `docs: update Readme.md` The project includes specialized agents for specific tasks: - **Writing Agent** (`.github/agents/writing-agent.md`) - Content creation and editing following the site's writing style -- **Content Collections Agent** (`.github/agents/content-collections-agent.md`) - Managing posts and notes collections, directory structure, and permalinks When working on tasks related to these domains, consult the appropriate agent documentation.