diff --git a/src/lib/expand-unit.ts b/src/lib/expand-unit.ts index 07003545..2cf7d12f 100644 --- a/src/lib/expand-unit.ts +++ b/src/lib/expand-unit.ts @@ -94,9 +94,10 @@ export const expandCrossbellNote = async ({ ...new Set(expandedNote.metadata.content.images), ] - if (!disableAutofill) { - expandedNote.metadata.content.slug = getNoteSlug(expandedNote) - } + expandedNote.metadata.content.slug = getNoteSlug( + expandedNote, + disableAutofill, + ) if ( !expandedNote.metadata.content.date_published && expandedNote.noteId && diff --git a/src/lib/helpers.ts b/src/lib/helpers.ts index 03e998dd..d7e01563 100644 --- a/src/lib/helpers.ts +++ b/src/lib/helpers.ts @@ -27,13 +27,11 @@ export const getSiteLink = ({ return `${IS_PROD ? "https" : "http"}://${subdomain}.${OUR_DOMAIN}` } -export const getNoteSlug = (note: NoteEntity) => { +export const getNoteSlug = (note: NoteEntity, disableAutofill?: boolean) => { return encodeURIComponent( note.metadata?.content?.attributes?.find( (a) => a?.trait_type === "xlog_slug", - )?.value || - note.metadata?.content?.title || - "", + )?.value || (disableAutofill ? "" : note.metadata?.content?.title || ""), ) }