diff --git a/stream/handlers.go b/stream/handlers.go index 86b94e71..49e4a06d 100644 --- a/stream/handlers.go +++ b/stream/handlers.go @@ -239,31 +239,19 @@ func renderEvent(e *Event, viewerID string) string { bubbleBg = "#fff" } - // Build content — escape then linkify URLs. + // Build content — escape then linkify URLs. Links are inline in the + // text, not separate preview cards. The console is conversational, + // not a feed — keep it tight. escaped := htmlpkg.EscapeString(e.Content) linked := urlPattern.ReplaceAllStringFunc(escaped, func(u string) string { return fmt.Sprintf(`%s`, u, u) }) - // OG embed for events that have a URL in metadata — news headlines, - // links shared by the system. The embed is a small preview card - // loaded lazily via an iframe hitting /web/read which renders the - // page's OG tags. - ogEmbed := "" + // For news/system events with a URL in metadata, append a subtle + // link if the URL isn't already in the content text. if e.Metadata != nil { - if u, ok := e.Metadata["url"].(string); ok && u != "" { - ogEmbed = fmt.Sprintf(`
` + if u, ok := e.Metadata["url"].(string); ok && u != "" && !strings.Contains(e.Content, u) { + linked += fmt.Sprintf(` → read`, htmlpkg.EscapeString(u)) } } @@ -277,8 +265,8 @@ func renderEvent(e *Event, viewerID string) string { return fmt.Sprintf(`