b913a2bf90
Refs gitea:Adriano/AI-OS#310 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
44 lines
1022 B
Markdown
44 lines
1022 B
Markdown
### Task 12: Firma autore nel blog pubblico
|
|
|
|
**Files:**
|
|
- Modify: `src/pages/blog/[slug].astro`
|
|
|
|
**Interfaces:**
|
|
- Consumes: `getUsernameById` (auth.ts), `post.author_id`.
|
|
|
|
- [ ] **Step 1: Aggiungi la firma**
|
|
|
|
In `src/pages/blog/[slug].astro`, aggiungi l'import e calcola l'autore nel frontmatter:
|
|
|
|
```astro
|
|
import { getUsernameById } from '../../lib/auth';
|
|
```
|
|
|
|
Dopo `const post = getPublishedBySlug(...)` e il check 404, aggiungi:
|
|
|
|
```typescript
|
|
const author = post.author_id ? getUsernameById(getDb(), post.author_id) : null;
|
|
const byline = author ?? 'Staff InsanityLab';
|
|
```
|
|
|
|
Nel markup, cambia la riga meta per includere la firma:
|
|
|
|
```astro
|
|
<p class="art__meta">{post.published_at && fmt.format(new Date(post.published_at))} · {post.category} · di {byline}</p>
|
|
```
|
|
|
|
- [ ] **Step 2: Verifica build**
|
|
|
|
Run: `npm run build`
|
|
Expected: build OK.
|
|
|
|
- [ ] **Step 3: Commit**
|
|
|
|
```bash
|
|
git add src/pages/blog/[slug].astro
|
|
git commit -m "feat(blog): firma autore sotto il titolo, fallback Staff InsanityLab"
|
|
```
|
|
|
|
---
|
|
|