Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. Comment |
There was a problem hiding this comment.
slug が存在しないときに 404 にならず 500 とかになると思うので、その点を修正してほしいです!
There was a problem hiding this comment.
これをやると lint エラーもいくつか消えると思います
| const { doc } = Astro.props; | ||
| const { Content } = await render(doc); | ||
| if (metaData) { | ||
| filteredDocs = await getCollection("docs", ({ id }) => id.startsWith(`${slug}/`)); |
There was a problem hiding this comment.
2階層まで許容だと思うんですが、これだとすべて同階層表示となって親子関係がわからなくなってしまうなと思いました
There was a problem hiding this comment.
category 名と md ファイル名の重複を避ける1つの手段として
カテゴリー側を src/pages/categories/[...slug].astro に置くというのがある気がします
| let article; | ||
| let Content; | ||
| let filteredDocs = []; |
There was a problem hiding this comment.
三項演算子を使うなどして let を使わなくできると BEST です
There was a problem hiding this comment.
初期値なしで let を使うと any 型になって型の警告にもなるので注意が必要です!
概要
getCollectionではなくgetEntryを使う用に変更した関連 Issue
備考
変更内容の詳細
目次と記事の切り替えは以下の通りである。
このように
metaDataが存在するか否かで決めている。metaDataはgetEntry("metaData", `${slug}/meta`)で取得されるため、ディレクトリ名と重複する.mdファイルは基本的に避けて欲しい。データの取得は以下の通りである。
このように
metaDataが存在するか否かで決めている。とにかくディレクトリ名と重複する
.mdファイルは基本的に避けて欲しい(挙動がわからない)。エディタ警告部分
slugがundefinedの可能性がある、filteredDocsはanyの可能性がある、articleはundefinedの可能性がある等々色々出ているが後々対応を考えていきたい。