Skip to content

Commit b76cb43

Browse files
committed
fix
1 parent b2e724b commit b76cb43

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

web/src/pages/[...appPath].astro

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ try {
4343
}
4444
4545
if (uri) {
46-
const res = await fetch(`${API_URL}/api/annotation?uri=${encodeURIComponent(uri)}`);
46+
const isCollection = uri.includes('/at.margin.collection/');
47+
const endpoint = isCollection ? 'collection' : 'annotation';
48+
const res = await fetch(`${API_URL}/api/${endpoint}?uri=${encodeURIComponent(uri)}`);
4749
if (res.ok) {
4850
const item = await res.json();
4951
const author = item.author || item.creator || {};
@@ -63,7 +65,7 @@ try {
6365
? `${targetTitle} — bookmarked by @${handle}`
6466
: `Bookmark by @${handle}`;
6567
description = bodyText?.slice(0, 200) || 'A bookmark on Margin';
66-
} else if (uri.includes('/at.margin.collection/')) {
68+
} else if (isCollection) {
6769
title = `${item.name || 'Collection'} by @${handle}`;
6870
description = item.description?.slice(0, 200) || 'A collection on Margin';
6971
} else {

0 commit comments

Comments
 (0)