Skip to content

SWF(refactor): derive post types from the content collection - #818

Open
suree33 wants to merge 1 commit into
mainfrom
devin/1795146211-derive-post-type
Open

suree33 wants to merge 1 commit into
mainfrom
devin/1795146211-derive-post-type

Conversation

@suree33

@suree33 suree33 commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

記事の frontmatter 型を CollectionEntry<'posts'>['data'] から導出し、スキーマと同じ項目を手書きする必要をなくしました。

固定ページは公開日を省略できる別の型で扱い、タグ一覧と RSS では公開日がある項目だけを掲載します。既存のページや配信内容は変わりません。

検証

  • pnpm run lint: Astro の型エラー 0 件。ユニットテスト 132 件と Chromium の対象 E2E 26 件が成功しました。
  • 変更前後を同じ外部通信スタブでビルドし、生成した全 250 ファイルが diff -qr で一致しました。RSS には従来どおり /dreamhouse が入り、公開日がない /about は入りません。
  • ローカルでは Chromium 以外のブラウザは未確認です。

再現: pnpm run lint && pnpm run build:e2e


Software Factory opened this PR for Daiki
Implemented in session Derive Post type from content collection schema
Review with Devin · Open in Devin Desktop


Summary by CodeRabbit

  • New Features
    • Standalone pages with a title and publication date now appear in the RSS feed, with descriptions and page content included when available.
  • Bug Fixes
    • Tag pages now show only posts that have a publication date and match the selected tag.

Co-Authored-By: Daiki Sato <d@sur33.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access that start with 'Devin'.

  • Disable automatic comment, CI, and merge conflict monitoring

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The pull request updates post and standalone-page frontmatter types. It adjusts the RSS route, Markdown post layout, tag page, and PostItem to use the revised types and handle optional date fields.

Changes: Frontmatter consumers

Layer / File(s) Summary
Frontmatter contract and standalone-page loading
src/types/Post.ts, src/lib/posts.ts, src/layouts/MarkdownPostLayout.astro
PostFrontmatter now derives from the Astro posts collection. StandalonePageFrontmatter allows an optional publication date and a nullable optional update date. The standalone-page loader and layout use this type; the layout passes undefined to PostMetadata when updatedDate is nullish.
Standalone pages in the RSS feed
src/pages/rss.xml.ts
The route prepares standalone-page feed items separately. It excludes pages without a title or publication date and filters out undefined items before adding them to the feed.
Typed tag-page posts and post items
src/pages/tags/[tag].astro, src/components/PostItem.astro
The tag page excludes posts without a publication date and infers its props type. PostItem declares its post prop as Post.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Merge Risk: Minimal · up to 176d5

This refactor derives post frontmatter types from the content collection and leaves page and feed output unchanged. No concrete merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "SWF(refactor): derive post types from the content collection" matches the main change. The PR derives PostFrontmatter from CollectionEntry<'posts'>['data'] and adds StandalonePageFrontmatte…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "SWF(refactor): derive post types from the content collection" matches the main change. The PR derives PostFrontmatter from CollectionEntry<'posts'>['data'] and adds StandalonePageFrontmatter for fixed pages. The title names the primary intent, though it does not mention the pages, RSS, or tag filtering changes. The title is specific and accurate, so it passes.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit reads the frontmatter page,
Dates may be absent, types take the stage.
Tags find posts with dates in view,
RSS keeps pages that qualify too.
I hop through the feed, then nibble a leaf.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3165729b-85fc-4098-befa-610d3cb09809
Commits

Reviewing files that changed from the base of the PR and between e693614 and 176d5e7.

Files selected for processing: 6

  • src/components/PostItem.astro
  • src/layouts/MarkdownPostLayout.astro
  • src/lib/posts.ts
  • src/pages/rss.xml.ts
  • src/pages/tags/[tag].astro
  • src/types/Post.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@devin-ai-integration

Copy link
Copy Markdown
Contributor

QA レポート: 合格

PR head 176d5e7 と merge-base e693614 を比べました。

確認項目 結果
生成物の比較(同じ外部通信スタブでビルド、全 250 ファイル) diff -qr で差分なし
トップ、記事 17 件、タグ 26 ページ、About、RSS、Markdown 出力 16 件 すべてバイト単位で一致
RSS の固定ページ /dreamhouse を含み、/about を含まない(変更前と同じ)
pnpm run lint エラー 0 件、警告 0 件
pnpm run test:e2e --project=chromium 70 件成功、2 件スキップ
ローカル Worker でのブラウザ確認(トップ、タグ、About、RSS、.md) 表示と応答は正常(.md は text/markdown; charset=utf-8)

タグページ

失敗はありません。生成物が同一なので録画は省きました。

未確認の項目

  • Chromium 以外のブラウザ
  • 実際の OGP 取得を伴うビルド(外部通信はスタブで固定)
  • 公開日のない記事がタグ一覧から外れる挙動(該当する記事が現在ないため)

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
blog 176d5e7 Commit Preview URL

Branch Preview URL
Nov 20 2026, 03:51 AM

This branch has not been deployed

No deployments
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.

1 participant