feat: links cruzados autor->/autor y parodia->/franquicia en posts

This commit is contained in:
Renato
2026-08-05 02:38:06 +08:00
parent a237d08f59
commit 702c6a5781
2 changed files with 37 additions and 5 deletions
+17
View File
@@ -420,6 +420,23 @@ export function getAuthorBySlug(slug: string): Author | null {
return row ? rowToAuthor(row) : null
}
// Devuelve el slug de un autor por su nombre (para enlazar desde los posts).
// Si el autor no está registrado, lo registra sobre la marcha.
export function getAuthorSlugByName(name: string): string | null {
const d = getDb()
const clean = (name || "").trim()
if (!clean || clean === "sin artista" || clean === "dummy") return null
d.prepare("INSERT OR IGNORE INTO authors(name, slug) VALUES (?, ?)").run(
clean,
slugify(clean),
)
const row = d.prepare("SELECT slug FROM authors WHERE name = ?").get(clean) as
| { slug: string }
| undefined
return row ? row.slug : null
}
export function getSeriesBySlug(slug: string): Series | null {
const d = getDb()
const row = d