41 lines
7.2 KiB
Markdown
41 lines
7.2 KiB
Markdown
|
|
# Post
|
||
|
|
|
||
|
|
`/channels/[username]/posts/[id]` · `apps/{bull,bear}/src/app/(main)/channels/[username]/posts/[id]/page.tsx` · Type: blog article · Layout: [layout-main.md](layout-main.md), [layout.md](layout.md)
|
||
|
|
|
||
|
|
| Field | Value |
|
||
|
|
| ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||
|
|
| Robots | `index; noindex when` the post is missing, belongs to another channel, or the channel is suspended (`generateMetadata`) |
|
||
|
|
| Status | `200`; `308` when the username segment isn't the stored spelling (`ROUTES.post`), and from `/@username/…` (0064); `200` with `not-found.tsx` when the username is invalid or the channel is missing, because `loading.tsx` wraps the page; `200` with `noindex` and `PostMissing` when the post is missing (debt) |
|
||
|
|
| loading.tsx | `apps/{bull,bear}/src/app/(main)/channels/[username]/posts/[id]/loading.tsx` (debt, Notes) |
|
||
|
|
| First flush | `getChannel(username)` and `getPost(id)` in one `Promise.all` through `readOnServer`, which the page entry and `generateMetadata` await (0055) |
|
||
|
|
| Canonical | `/channels/username/posts/id`, from `postMetadata`; drops `?preview=` |
|
||
|
|
| H1 | none (debt) |
|
||
|
|
| JSON-LD | none (debt, Notes) |
|
||
|
|
| Scripts | none |
|
||
|
|
|
||
|
|
## Sections
|
||
|
|
|
||
|
|
In bull's document order.
|
||
|
|
|
||
|
|
| Section | Data | HTML | JS | Index | Notes |
|
||
|
|
| -------------------- | ---------------------- | ----------- | ----------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||
|
|
| MobileTopBar (bull) | viewer | skeleton | hydrate | no | back to the channel (`parentHref`, `backToPrevious`, 0057); the title waits for the viewer |
|
||
|
|
| DeskBack (bear) | — | first flush | hydrate | no | «بازگشت» to the channel |
|
||
|
|
| PostChannelBar | `getChannel(username)` | first flush | none | primary | `<a href>` to the channel: avatar, name, `@username` |
|
||
|
|
| ↳ ChannelActions | viewer | skeleton | hydrate | no | follow and subscribe; own `PartBoundary` |
|
||
|
|
| PostView | `getPost(id)` | first flush | hydrate | primary | a free post's caption and images; a premium post's `captionPreview` and media count only; re-read in the browser for the creator or a subscriber (0021) |
|
||
|
|
| ↳ Locked post gate | viewer | skeleton | hydrate | no | guest: login back here; investor: checkout |
|
||
|
|
| ↳ PreviewBanner | viewer | none | hydrate | no | the creator's `?preview=` of their own premium post |
|
||
|
|
| ↳ PostLightbox | — | none | interaction | no | `next/dynamic`, mounted on the first image tap |
|
||
|
|
| ↳ Access-ended toast | viewer | none | hydrate | no | the info toast when access ends mid-read (0050) |
|
||
|
|
| PostMissing | `getChannel(username)` | first flush | hydrate | no | instead of `PostView` when the post is missing; a link back to the channel |
|
||
|
|
| ChannelUnavailable | `getChannel(username)` | first flush | hydrate | no | replaces the bar and post when the channel is suspended |
|
||
|
|
|
||
|
|
## Notes
|
||
|
|
|
||
|
|
- bull: under `MobileTopBar`, a padded column; bear: the 640px column under «بازگشت». Both hold the same primary rows.
|
||
|
|
- Debt: `loading.tsx` wraps an indexable entity page: a missing channel answers 200, and past 12,800 bytes the post follows the skeleton. Delete it.
|
||
|
|
- Debt: a missing post answers 200 with `PostMissing` (`PostTemplate.tsx:67`), a soft 404. Call `notFound()` in the page entry and move `PostMissing` into a route `not-found.tsx`.
|
||
|
|
- Debt: no H1. Make the post's first line, the text `postMetadata` titles it with, the H1 in both apps.
|
||
|
|
- Debt: no JSON-LD; an article-type page gets `BreadcrumbList`. The repo has no json-ld lib yet.
|