diff --git a/packages/remanso/src/commands/sync.ts b/packages/remanso/src/commands/sync.ts --- a/packages/remanso/src/commands/sync.ts +++ b/packages/remanso/src/commands/sync.ts @@ -204,12 +204,12 @@ ); s.stop(`Found ${localPosts.length} publishable notes (.pub.md)`); - // Build a map of path -> local post for matching - // Use "/posts" prefix (same default as publish command) - const pathPrefix = "/posts"; - const postsByPath = new Map(); + // Build a map from atUri -> local post for matching + const postsByAtUri = new Map(); for (const post of localPosts) { - postsByPath.set(`${pathPrefix}/${post.slug}`, post); + if (post.frontmatter.atUri) { + postsByAtUri.set(post.frontmatter.atUri, post); + } } // Load existing state @@ -225,7 +225,7 @@ for (const doc of documents) { const docPath = doc.value.path; - const localPost = postsByPath.get(docPath); + const localPost = postsByAtUri.get(doc.uri); if (localPost) { matchedCount++;