Skip to content

Adapter and publisher registries with eight static-site adapters#7

Closed
bnz183 wants to merge 1 commit into
split/05-demo-playwrightfrom
split/06-adapters
Closed

Adapter and publisher registries with eight static-site adapters#7
bnz183 wants to merge 1 commit into
split/05-demo-playwrightfrom
split/06-adapters

Conversation

@bnz183

@bnz183 bnz183 commented Jun 9, 2026

Copy link
Copy Markdown
Owner

PR 6 of 11. Adapter/publisher registries and eight static-site adapters with examples.

article: Article,
config: DocusaurusMdxPathConfig,
): string {
const contentDir = config.contentDir.replace(/\/+$/u, "");
article: Article,
config: EleventyJekyllMarkdownPathConfig,
): string {
const contentDir = config.contentDir.replace(/\/+$/u, "");
article: Article,
config: HugoMarkdownPathConfig,
): string {
const contentDir = config.contentDir.replace(/\/+$/u, "");
article: Article,
config: MkdocsMarkdownPathConfig,
): string {
const contentDir = config.contentDir.replace(/\/+$/u, "");
article: Article,
config: NextjsMdxPathConfig,
): string {
const contentDir = config.contentDir.replace(/\/+$/u, "");
article: Article,
config: NuxtContentMarkdownPathConfig,
): string {
const contentDir = config.contentDir.replace(/\/+$/u, "");

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7bf79e14c8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +37 to +40
`title: ${yamlScalar(article.title)}`,
`description: ${yamlScalar(article.description)}`,
`slug: ${yamlScalar(article.slug)}`,
];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve required fields in Docusaurus output

When the Studio publishes with docusaurus-mdx, this frontmatter only persists title/description/slug; docusaurusMdxFromFrontmatter later reads date/pubDate, category, and draft only from frontmatter, and validateArticle requires those fields. A post created by this adapter therefore gets skipped by listPosts and fails loadPost validation immediately after publishing, so the adapter needs to emit or otherwise round-trip the required SourceDraft fields.

Useful? React with 👍 / 👎.

Comment on lines +17 to +20
`title: ${yamlScalar(article.title)}`,
`description: ${yamlScalar(article.description)}`,
`date: ${yamlScalar(article.pubDate)}`,
...formatYamlTags(article.tags),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Persist category for MkDocs round-trips

For mkdocs-markdown, the rendered frontmatter omits category, but mkdocsMarkdownFromFrontmatter returns category: frontmatter.category and the Studio validates loaded posts with validateArticle, where category is required. Any post published through this adapter will be written successfully but then be omitted from the posts list and fail to reopen because its own output cannot validate.

Useful? React with 👍 / 👎.

pushYamlOptional(frontmatter, "lastmod", article.updatedDate);
frontmatter.push(`draft: ${article.draft}`);
pushYamlOptional(frontmatter, "slug", article.slug);
frontmatter.push(...formatYamlCategories(article.category));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Round-trip Hugo categories through the Studio parser

With the default Hugo YAML mode, the adapter writes the SourceDraft category as a categories: list, but the Studio frontmatter parser only has special handling for tags: lists before calling hugoMarkdownFromFrontmatter, which expects frontmatter.categories to be an array. As a result, Hugo posts created by SourceDraft reload with category undefined and fail validation/listing; either emit a scalar the parser already supports or teach the parser to read this array shape.

Useful? React with 👍 / 👎.

Comment on lines +92 to +95
const frontmatter =
resolved.frontmatterFormat === "toml"
? renderTomlFrontmatter(article)
: renderYamlFrontmatter(article);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Parse Hugo TOML before enabling TOML output

When a user sets adapterOptions.frontmatterFormat to toml, this branch writes +++ TOML frontmatter, but the Studio load/list path still uses splitFrontmatter, which only accepts --- YAML delimiters. Posts published in this supported mode will be saved but then disappear from listing and return “frontmatter is missing or invalid” on load, so TOML parsing/delimiter support needs to land with the option.

Useful? React with 👍 / 👎.

Comment on lines +25 to +27
function defaultSlugFromPath(path: string): string {
const filename = path.split("/").pop() ?? "";
return slugFromFilename(filename);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Derive slugs from index paths correctly

When filenameConvention: "index" is used for adapters that do not emit a slug field, such as MkDocs or Nuxt Content, publishing creates paths like content/blog/my-post/index.md, but loading calls this helper and first discards the parent directory, so the derived slug becomes index instead of my-post. That means newly published index-style posts reopen with the wrong slug and can later be republished to the wrong default path; preserve enough path context or use the adapter-specific slug parser for these conventions.

Useful? React with 👍 / 👎.

Comment on lines +12 to +16
author?: unknown;
metaTitle?: unknown;
metaDescription?: unknown;
canonicalUrl?: unknown;
socialImage?: unknown;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Persist new SEO fields in existing adapters

These fields are now accepted and normalized for all publish requests, but the existing astro-mdx and markdown renderers still omit author, metaTitle, metaDescription, canonicalUrl, and socialImage. With the default adapter, an API client can publish successfully with these values and have them silently dropped from the committed file, unlike the new adapters and the docs' compatibility matrix.

Useful? React with 👍 / 👎.

@bnz183

bnz183 commented Jun 9, 2026

Copy link
Copy Markdown
Owner Author

Closing retroactive split-stack review PR. Continuing from protected main with scoped feature PRs.

@bnz183 bnz183 closed this Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants