Skip to content

fix: open external links in new tab#326

Merged
chadbyte merged 1 commit intochadbyte:mainfrom
akuehner:fix/external-links-new-tab
Apr 22, 2026
Merged

fix: open external links in new tab#326
chadbyte merged 1 commit intochadbyte:mainfrom
akuehner:fix/external-links-new-tab

Conversation

@akuehner
Copy link
Copy Markdown
Contributor

Problem

External URLs in chat messages open in the same tab, navigating away from the Clay session. Example: clicking an Indeed job link mid-session loses the conversation.

Fix

Add a custom marked renderer for links. External URLs (http://, https://) get target="_blank" rel="noopener noreferrer". Internal anchor links (#section) are unaffected.

marked.use({
  renderer: {
    link({ href, title, text }) {
      var isExternal = href && (href.startsWith('http://') || href.startsWith('https://'));
      var titleAttr = title ? ' title="' + title + '"' : '';
      var targetAttr = isExternal ? ' target="_blank" rel="noopener noreferrer"' : '';
      return '<a href="' + href + '"' + titleAttr + targetAttr + '>' + text + '</a>';
    }
  }
});

One file changed: lib/public/modules/markdown.js.

External URLs in chat messages (http/https) now open in a new browser
tab via target="_blank" rel="noopener noreferrer". Internal anchor
links are unaffected.
@chadbyte chadbyte merged commit 2011da9 into chadbyte:main Apr 22, 2026
@github-actions
Copy link
Copy Markdown
Contributor

This issue has been resolved in version 2.32.1-beta.1 (main).

To update, run:

npx clay-server@2.32.1-beta.1

-- Clay Deploy Bot

Build anything, with anyone, in one place.

@github-actions
Copy link
Copy Markdown
Contributor

This issue has been resolved in version 2.33.0 (stable).

To update, run:

npx clay-server@2.33.0

-- Clay Deploy Bot

Build anything, with anyone, in one place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants