Commit c307b47
fix(blog): drop posts without a slug from listings
A post whose slug is missing, empty or blank has no route. It still rendered
in listings, producing cards that link nowhere and a broken url in the
JSON-LD.
Filter it out in filterPosts, ahead of every other filter and of slicePosts,
so `count` still yields `count` renderable posts. Records come straight from
the CMS and are cast without validation, so the guard also checks the type:
a non-string slug would otherwise throw inside handlePosts, and the
try/catch in the loaders would turn that into an empty listing.
Co-Authored-By: Claude <noreply@anthropic.com>1 parent b5abb45 commit c307b47
1 file changed
Lines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
172 | 183 | | |
173 | | - | |
| 184 | + | |
174 | 185 | | |
175 | 186 | | |
176 | 187 | | |
177 | 188 | | |
| 189 | + | |
| 190 | + | |
178 | 191 | | |
179 | 192 | | |
180 | 193 | | |
| |||
0 commit comments