Skip to content

Commit 0b18450

Browse files
committed
New theme and publish options / front matter
1 parent 1258b0f commit 0b18450

22 files changed

Lines changed: 2549 additions & 1613 deletions

File tree

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@ node_modules
1515

1616
# Test outputs
1717

18-
test-results.txt
18+
test-results.txt
19+
20+
# AgentKanban
21+
22+
.vscode/mcp.json

.vscode/launch.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"request": "launch",
88
"args": [
99
"--extensionDevelopmentPath=${workspaceFolder}/vs-code-extension",
10-
"--disable-extensions"
10+
"--disable-extensions",
11+
"${env:HOME}/src/as-notes-demo-notes"
1112
],
1213
"outFiles": [
1314
"${workspaceFolder}/vs-code-extension/dist/**/*.js"

README.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,16 @@ These commands toggle or cycle publishing-related fields in the file's YAML fron
201201
| **Retina** | Toggles `retina: true` / `retina: false` in front matter |
202202
| **Assets** | Toggles `assets: true` / `assets: false` in front matter |
203203

204+
#### Front Matter Presets *(files without existing front matter)*
205+
206+
These commands appear only when the current file has no YAML front matter block. They insert a complete front matter template with tabstop placeholders for easy editing.
207+
208+
| Command | Action |
209+
|---|---|
210+
| **Front Matter: Blog Post** | Inserts front matter for a blog post: `title`, `description`, `date` (today), `author`, `public: true`, `layout: blog` |
211+
| **Front Matter: Docs Page** | Inserts front matter for a docs page: `title`, `description`, `public: true`, `layout: docs`, `order` |
212+
| **Front Matter: Wiki Page** | Inserts front matter for a wiki page: `title`, `description`, `public: true` |
213+
204214
#### Kanban Card Commands *(kanban card files only)*
205215

206216
The following command only appears when editing a kanban card file (`kanban/card_*.md`).
@@ -522,7 +532,40 @@ The converter is published as an npm package:
522532
npx asnotes-publish --config ./asnotes-publish.json
523533
```
524534

525-
See [Publishing a Static Site](https://docs.asnotes.io/publishing-a-static-site.html) for full documenation
535+
#### Blog index generation
536+
537+
When the site-wide layout is `blog` (or `blogIndex: true` is set in the config), the auto-generated index page uses a blog-aware layout:
538+
539+
1. **Recent posts** — the most recent posts (configurable via `recentCount`, default 3) shown as cards with title, date, author, description, and optional hero image
540+
2. **Current year** — remaining posts for the current year as a compact date + title list
541+
3. **Year archives** — links to auto-generated `archive-YYYY.html` pages for previous years
542+
4. **Undated** — posts without a `date` in front matter are listed at the bottom
543+
544+
#### Front matter fields for publishing
545+
546+
| Field | Type | Description |
547+
|---|---|---|
548+
| `public` | boolean | Include page in published output |
549+
| `title` | string | Page title (defaults to filename) |
550+
| `description` | string | Meta description for SEO |
551+
| `date` | string | Publication date (`YYYY-MM-DD`) — used for blog sorting, RSS, and sitemap |
552+
| `author` | string | Post author — displayed in blog layout and RSS feed |
553+
| `image` | string | Hero/thumbnail image path — displayed in blog layout and blog index cards |
554+
| `layout` | string | Per-page layout override (`docs`, `blog`, `minimal`) |
555+
| `order` | number | Navigation sort order |
556+
| `draft` | boolean | Exclude from output unless `--include-drafts` is set |
557+
| `assets` | boolean | Copy referenced images to output |
558+
| `retina` | boolean | Enable retina image sizing |
559+
560+
#### Blog config options
561+
562+
| Option | Type | Default | Description |
563+
|---|---|---|---|
564+
| `siteTitle` | string | `"AS Notes Site"` | Site title used in RSS feed and blog index |
565+
| `recentCount` | number | `3` | Number of recent posts shown as cards on the blog index |
566+
| `blogIndex` | boolean | `false` | Use blog-style index generation (auto-enabled when `layout: "blog"`) |
567+
568+
See [Publishing a Static Site](https://docs.asnotes.io/publishing-a-static-site.html) for full documentation
526569

527570
### Debugging
528571

common/src/FrontMatterService.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ export interface FrontMatterFields {
3939
retina?: boolean;
4040
draft?: boolean;
4141
date?: string;
42+
author?: string;
43+
image?: string;
4244
aliases?: string[];
4345
}
4446

@@ -143,6 +145,12 @@ export class FrontMatterService {
143145
case 'date':
144146
fields.date = this.parseStringValue(rawValue);
145147
break;
148+
case 'author':
149+
fields.author = this.parseStringValue(rawValue);
150+
break;
151+
case 'image':
152+
fields.image = this.parseStringValue(rawValue);
153+
break;
146154
case 'aliases':
147155
fields.aliases = this.parseAliasesFromLine(rawValue, lines, i);
148156
break;

common/test/FrontMatterService.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,16 @@ describe('FrontMatterService — parseFrontMatterFields', () => {
258258
expect(service.parseFrontMatterFields(content).date).toBe('2026-03-23');
259259
});
260260

261+
it('should parse author field', () => {
262+
const content = '---\nauthor: Jane Doe\n---\n\n# Page';
263+
expect(service.parseFrontMatterFields(content).author).toBe('Jane Doe');
264+
});
265+
266+
it('should parse image field', () => {
267+
const content = '---\nimage: assets/images/hero.png\n---\n\n# Page';
268+
expect(service.parseFrontMatterFields(content).image).toBe('assets/images/hero.png');
269+
});
270+
261271
it('should parse aliases via parseFrontMatterFields', () => {
262272
const content = '---\naliases: [Alias A, Alias B]\n---\n\n# Page';
263273
expect(service.parseFrontMatterFields(content).aliases).toEqual(['Alias A', 'Alias B']);
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<div class="site-header">
22
<a class="site-title" href="{{base-url}}/">
3-
<svg class="site-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 191.82 166.13" width="24" height="21"><path fill="currentColor" fill-rule="evenodd" d="M67.09,132.92,47.93,166.13H9.59L0,149.52,86.33,0H105.5L19.17,149.52H38.34l19.17-33.2h76.8l9.59,16.6Zm48-83.12,9.65,16.71H143.9L115.08,16.6q-24,41.57-48,83.12H143.9q14.37,24.9,28.76,49.8h-96l-9.59,16.61H182.24l9.58-16.61-38.34-66.4H96C95.85,82.9,113.39,52.73,115.08,49.8Z"/></svg>
3+
{{site-icon}}
4+
{{site-title}}
45
</a>
5-
</div>
6+
</div>
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<div class="site-header">
22
<a class="site-title" href="{{base-url}}/">
3-
<svg class="site-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 191.82 166.13" width="24" height="21"><path fill="currentColor" fill-rule="evenodd" d="M67.09,132.92,47.93,166.13H9.59L0,149.52,86.33,0H105.5L19.17,149.52H38.34l19.17-33.2h76.8l9.59,16.6Zm48-83.12,9.65,16.71H143.9L115.08,16.6q-24,41.57-48,83.12H143.9q14.37,24.9,28.76,49.8h-96l-9.59,16.61H182.24l9.58-16.61-38.34-66.4H96C95.85,82.9,113.39,52.73,115.08,49.8Z"/></svg>
3+
{{site-icon}}
4+
{{site-title}}
45
</a>
5-
</div>
6+
</div>
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)