## Summary Add rich link previews when URLs are shared in chat messages. ## Current Behavior URLs in `sioc:content` are displayed as plain text or simple links. ## Proposed Implementation ### 1. URL Detection Parse `sioc:content` for URLs matching common patterns: ```regex https?://[^\s]+ ``` ### 2. Metadata Fetching Fetch Open Graph / meta tags from linked pages: ```html <meta property="og:title" content="..." /> <meta property="og:description" content="..." /> <meta property="og:image" content="..." /> <meta property="og:site_name" content="..." /> ``` Fallback to: - `<title>` tag - `meta[name="description"]` - First image on page ### 3. Preview Card UI Display inline preview card: ``` ┌─────────────────────────────────┐ │ 🖼️ [og:image thumbnail] │ │ Site Name │ │ **Title** │ │ Description text... │ └─────────────────────────────────┘ ``` ### 4. RDF Storage (Optional) Cache preview data in message: ```turtle <#msg1> sioc:content "Check this out https://example.com" ; schema:sharedContent [ a schema:WebPage ; schema:url <https://example.com> ; schema:name "Page Title" ; schema:description "..." ; schema:image <https://example.com/og.png> ] . ``` ## Considerations - [ ] CORS: May need server-side proxy for fetching OGP - [ ] Caching: Store previews to avoid re-fetching - [ ] Privacy: User opt-in for auto-fetching? - [ ] Multiple URLs: Show multiple previews or just first? ## References - Open Graph Protocol: https://ogp.me/ - Twitter Cards: https://developer.twitter.com/en/docs/twitter-for-websites/cards - schema.org WebPage: https://schema.org/WebPage
Activity