fix: slugs are updating now

This commit is contained in:
2026-02-10 17:05:56 +01:00
parent 5c10ed3fd5
commit 29d9308100
2 changed files with 19 additions and 1 deletions

View File

@@ -305,8 +305,18 @@ export class PostEngine extends EventEmitter {
// Auto-update slug when title changes, but only if post was never published
let newSlug = data.slug ?? existing.slug;
console.log('[updatePost] Slug update check:', {
'data.title': data.title,
'existing.title': existing.title,
'existing.publishedAt': existing.publishedAt,
'titleDefined': data.title !== undefined,
'titleChanged': data.title !== existing.title,
'neverPublished': !existing.publishedAt,
'shouldUpdateSlug': data.title !== undefined && data.title !== existing.title && !existing.publishedAt,
});
if (data.title !== undefined && data.title !== existing.title && !existing.publishedAt) {
newSlug = await this.generateUniqueSlug(data.title || 'untitled', id);
console.log('[updatePost] Generated new slug:', newSlug);
}
const updated: PostData = {