Skip to content

Commit d9814da

Browse files
committed
fix(web,ui): filter technical metadata from bookmark notes display
Remove URL, Title, and Tags metadata lines from notes display in both sidebar BookmarkCard and main BookmarkListItem components. Users now see only user-authored notes without internal navigation/metadata info.
1 parent 1654bc6 commit d9814da

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

apps/web/src/components/layout/BookmarkCard.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,13 @@ export const BookmarkCard = ({ bookmark, onClose, onDeleted }: BookmarkCardProps
138138
});
139139
};
140140

141-
// Filter out URL and Title from notes for display
141+
// Filter out technical metadata (URL, Title, Tags) from notes for display
142142
const notesDisplay = bookmark.notes
143143
?.split('\n')
144-
.filter(line => !line.startsWith('URL:') && !line.startsWith('Title:'))
145-
.join('\n');
144+
.filter(line => !line.startsWith('URL:') && !line.startsWith('Title:') && !line.startsWith('Tags:'))
145+
.map(line => line.trim())
146+
.filter(Boolean)
147+
.join('\n') || undefined;
146148

147149
return (
148150
<Card

packages/ui/src/bookmarks/BookmarkListItem.tsx

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,27 @@ export interface BookmarkListItemProps {
4747
*/
4848
const getEntityTypeLabel = (entityType: EntityType): string => entityType.charAt(0).toUpperCase() + entityType.slice(1);
4949

50+
/**
51+
* Technical prefixes that should be filtered from notes display
52+
* These are used internally for storing navigation/metadata but aren't user-facing
53+
*/
54+
const TECHNICAL_NOTE_PREFIXES = ["URL:", "Title:", "Tags:"] as const;
55+
56+
/**
57+
* Filter out technical metadata lines from notes for user-friendly display
58+
* @param notes - Raw notes string
59+
* @returns Cleaned notes without technical metadata
60+
*/
61+
const filterNotesForDisplay = (notes: string | undefined): string | undefined => {
62+
if (!notes) return undefined;
63+
const filteredLines = notes
64+
.split("\n")
65+
.filter(line => !TECHNICAL_NOTE_PREFIXES.some(prefix => line.startsWith(prefix)))
66+
.map(line => line.trim())
67+
.filter(Boolean);
68+
return filteredLines.length > 0 ? filteredLines.join("\n") : undefined;
69+
};
70+
5071
/**
5172
* Get a color for entity type badges
5273
* @param entityType
@@ -228,12 +249,13 @@ export const BookmarkListItem = ({
228249
// Format timestamp
229250
const timestampText = formatRelativeTime(bookmark.metadata.timestamp);
230251

231-
// Truncate notes if they exist and are too long
252+
// Filter and truncate notes for display (remove technical metadata lines)
232253
const maxNotesLength = 150;
254+
const cleanedNotes = filterNotesForDisplay(bookmark.notes);
233255
const truncatedNotes =
234-
bookmark.notes && bookmark.notes.length > maxNotesLength
235-
? `${bookmark.notes.slice(0, maxNotesLength)}...`
236-
: bookmark.notes;
256+
cleanedNotes && cleanedNotes.length > maxNotesLength
257+
? `${cleanedNotes.slice(0, maxNotesLength)}...`
258+
: cleanedNotes;
237259

238260
return (
239261
<Card

0 commit comments

Comments
 (0)