36 lines
2.7 KiB
Markdown
36 lines
2.7 KiB
Markdown
---
|
|
created: 2026-10-09T11:22:00Z
|
|
title: Expose author subtitle, description and avatar on the Journal author API
|
|
area: plugins
|
|
severity: minor
|
|
files:
|
|
- ../sm-journal-plugin/controllers/api/authors.go
|
|
- modules/lagoon/backend_admin_migrations.go
|
|
g15office: esrp4qtx
|
|
---
|
|
|
|
## Problem
|
|
|
|
The WinterCMS author component (`journalAuthor`) shows `metadata.subtitle`, and its SEO add-on reads the author avatar and a description. The framework's `backend_users` table has no `metadata` column and no avatar attachment, so the D-20 endpoint `GET /_journal/api/v1/authors/{author}` exposes only `id`, `slug`, `first_name` and `last_name`. An author page built on it has no subtitle, bio or picture, and the import into `backend_users` creates authors without them.
|
|
|
|
## Solution
|
|
|
|
Make a framework decision on backend user profile storage first. Either add a `metadata` JSON column plus an avatar attachment on backend users (in `modules/lagoon/backend_admin_migrations.go` and the admin user form), or give the journal plugin its own author profile table edited in the admin. Then add the new keys to the author payload additively (`authorProfile` in `controllers/api/authors.go`), document them in the plugin README, and extend `TestJournalAuthorProfile`'s exact key set. Never emit a key without a storage source.
|
|
|
|
## Progress (2026-10-09, quick task 261009-mys)
|
|
|
|
The framework decision is made and shipped (commits 143eca5, 64d21c8, 4f1cda3, 89611ea): `backend_users.metadata` holds the subtitle under `subtitle` (WinterCMS-compatible), and the avatar is a WinterCMS-style `Backend\Models\User` `avatar` attachOne, both edited on the My account page. Plugins read them via `cabana.BackendUser.Subtitle()` and `cabana.BackendUserAvatar()`.
|
|
|
|
Still open:
|
|
- an editor for the author description (would fit `metadata.description`);
|
|
- `subtitle` and `avatar` keys in sm-journal-plugin's `authorProfile`, README and `TestJournalAuthorProfile`;
|
|
- the author import filling `metadata` and copying avatar file rows.
|
|
|
|
## Done (2026-10-20, Phase 19.4.1 plan 03)
|
|
|
|
sm-journal-plugin v0.2.1 (fe1bbc2) adds `subtitle`, `description` (`backend_users.metadata`, `""` when unset) and `avatar` (the public URL of the admin avatar, or null) to the author object of `GET /_journal/api/v1/authors/{author}`, with the README and `TestJournalAuthorProfile`'s exact key set; plan 05 (48d6593) adds the only-a-subtitle and odd-metadata cases. The demo shows it: demo:seed creates the SummerCMS Team author with subtitle, description and avatar, and demo.summercms.io renders the author card on posts and on /blog/author/summercms-team.
|
|
|
|
Follow-ups, not done here:
|
|
- an editor for the author description in the admin (My account writes `metadata.subtitle` only);
|
|
- the author import filling `metadata` and copying the avatar file rows.
|