diff --git a/docs/docs/pages/config.mdx b/docs/docs/pages/config.mdx index 672eb85..ab7fe76 100644 --- a/docs/docs/pages/config.mdx +++ b/docs/docs/pages/config.mdx @@ -10,24 +10,30 @@ import ConfigTable from '../../src/lib/ConfigTable.tsx' ```json { - "siteUrl": "https://example.com", + "$schema": "https://tangled.org/stevedylan.dev/sequoia/raw/main/sequoia.schema.json", "contentDir": "content/posts", - "imagesDir": "src/assets", - "publicDir": "public", - "outputDir": "dist", - "pathPrefix": "/posts", - "pathTemplate": "/blog/{year}/{month}/{slug}", "publicationUri": "at://did:plc:kq6bvkw4sxof3vdinuitehn5/site.standard.publication/3mdlavhxjhm2v", - "pdsUrl": "https://andromeda.social", - "frontmatter": { - "publishDate": "date" - }, - "ignore": ["_index.md"], + "siteUrl": "https://example.com", "autoSync": true, "bluesky": { "enabled": true, "maxAgeDays": 30 }, + "frontmatter": { + "publishDate": "date" + }, + "identity": "alice.example.com", + "ignore": ["_index.md"], + "imagesDir": "src/assets", + "outputDir": "dist", + "pathPrefix": "/posts", + "pathTemplate": "/blog/{year}/{month}/{slug}", + "pdsUrl": "https://andromeda.social", + "publicDir": "public", + "publishContent": true, + "removeIndexFromSlug": false, + "stripDatePrefix": false, + "textContentField": "excerpt", "ui": { "components": "src/components" } @@ -38,12 +44,12 @@ import ConfigTable from '../../src/lib/ConfigTable.tsx' | Field | Type | Required | Default Mapping | Description | |-------|------|----------|-----------------|-------------| -| `title` | `string` | Yes | `"title"` | Post title | -| `description` | `string` | No | `"description"` | Post description/summary | | `publishDate` | `string` | Yes | `"publishDate"`, `"pubDate"`, `"date"`, `"createdAt"`, `"created_at"` | Publication date | -| `coverImage` | `string` | No | `"ogImage"` | Cover image filename | -| `tags` | `string[]` | No | `"tags"` | Post tags/categories | -| `draft` | `boolean` | No | `"draft"` | If `true`, post is skipped during publish | +| `title` | `string` | Yes | `"title"` | Post title | +| `coverImage` | `string` | | `"ogImage"` | Cover image filename | +| `description` | `string` | | `"description"` | Post description/summary | +| `draft` | `boolean` | | `"draft"` | If `true`, post is skipped during publish | +| `tags` | `string[]` | | `"tags"` | Post tags/categories | ### Example @@ -122,7 +128,7 @@ This would produce paths like `/blog/2024/01/my-post`. | `{day}` | Zero-padded publish day (local time) | `15` | | `{dayUTC}` | Zero-padded publish day (UTC) | `15` | | `{title}` | Slugified post title | `my-first-post` | -| `{field}` | Any frontmatter field value (string fields only) | - | +| `{field}` | Any frontmatter field value (string fields only) | | When `pathTemplate` is set, it overrides `pathPrefix`. If `pathTemplate` is not set, the default `pathPrefix`/slug behavior is used. diff --git a/docs/src/lib/ConfigTable.tsx b/docs/src/lib/ConfigTable.tsx index 0e9f79a..d2a39e5 100644 --- a/docs/src/lib/ConfigTable.tsx +++ b/docs/src/lib/ConfigTable.tsx @@ -12,18 +12,20 @@ function extractProperties( properties: Record, required: string[], parentPath: string, + parentRequired: boolean, result: PropertyInfo[], ): void { for (const [key, value] of Object.entries(properties)) { const prop = value as Record; const fullPath = parentPath ? `${parentPath}.${key}` : key; - const isRequired = required.includes(key); + const isRequired = parentRequired && required.includes(key); if (prop.properties) { extractProperties( prop.properties as Record, (prop.required as string[]) || [], fullPath, + isRequired, result, ); } else { @@ -44,8 +46,16 @@ export default function ConfigTable() { schema.properties as Record, schema.required as string[], "", + true, rows, ); + // Show $schema, then required fields alphabetically, then optional fields alphabetically. + rows.sort( + (a, b) => + Number(b.path === "$schema") - Number(a.path === "$schema") || + Number(b.required) - Number(a.required) || + a.path.localeCompare(b.path), + ); return ( @@ -70,7 +80,7 @@ export default function ConfigTable() { - + ))} diff --git a/packages/cli/src/lib/types.ts b/packages/cli/src/lib/types.ts index 0aab171..9bbeb04 100644 --- a/packages/cli/src/lib/types.ts +++ b/packages/cli/src/lib/types.ts @@ -36,8 +36,8 @@ export interface PublisherConfig { siteUrl: string; contentDir: string; imagesDir?: string; // Directory containing cover images - publicDir?: string; // Static/public folder for .well-known files (default: public) - outputDir?: string; // Built output directory for inject command + publicDir?: string; // Static/public folder for .well-known files (default: ./public) + outputDir?: string; // Built output directory for inject command (default: ./dist) pathPrefix?: string; // URL path prefix for posts (default: /posts) publicationUri: string; pdsUrl?: string; diff --git a/sequoia.schema.json b/sequoia.schema.json index 1ec09bc..2905f45 100644 --- a/sequoia.schema.json +++ b/sequoia.schema.json @@ -7,16 +7,16 @@ "properties": { "$schema": { "type": "string", - "description": "JSON schema hint" + "description": "JSON schema hint for editor autocomplete and validation" }, "siteUrl": { "type": "string", "format": "uri", - "description": "Base site URL" + "description": "Base URL of your site" }, "contentDir": { "type": "string", - "description": "Directory containing content" + "description": "Directory containing content files to publish" }, "imagesDir": { "type": "string", @@ -25,11 +25,12 @@ "publicDir": { "type": "string", "description": "Static/public folder for `.well-known` files", - "default": "public" + "default": "./public" }, "outputDir": { "type": "string", - "description": "Built output directory for inject command" + "description": "Built output directory for inject command", + "default": "./dist" }, "pathPrefix": { "type": "string", @@ -38,7 +39,7 @@ }, "publicationUri": { "type": "string", - "description": "Publication URI" + "description": "AT URI of the publication record for this site" }, "pdsUrl": { "type": "string", @@ -98,7 +99,7 @@ }, "ignore": { "type": "array", - "description": "Glob patterns for files to ignore", + "description": "Glob patterns for files to ignore (for example, [\"_index.md\", \"**/drafts/**\"])", "items": { "type": "string" } @@ -123,7 +124,7 @@ }, "publishContent": { "type": "boolean", - "description": "Whether or not to publish the documents content on the standard.site document", + "description": "Whether or not to publish the document's content on the standard.site document", "default": true }, "bluesky": {
{row.required ? "Yes" : ""} {row.default === undefined ? ( - "-" + "" ) : ( {typeof row.default === "string" @@ -79,7 +89,7 @@ export default function ConfigTable() { )} {row.description || "—"}{row.description || ""}