Skip to content

fix: open external LinkedIn link in new tab on author page#327

Open
agarwalpranav0711 wants to merge 2 commits intokeploy:mainfrom
agarwalpranav0711:fix/external-link-new-tab-clean
Open

fix: open external LinkedIn link in new tab on author page#327
agarwalpranav0711 wants to merge 2 commits intokeploy:mainfrom
agarwalpranav0711:fix/external-link-new-tab-clean

Conversation

@agarwalpranav0711
Copy link
Copy Markdown

🐛 Fix: External LinkedIn link opens in same tab

Problem

On the author details page, the external LinkedIn link was opening in the same browser tab.
This redirected users away from the blog website.

Root Cause

The <Link> component was being used for an external URL without specifying:

  • target="_blank"
  • rel="noopener noreferrer"

Solution

Replaced the Next.js <Link> component with a standard <a> tag and added:

  • target="_blank"
  • rel="noopener noreferrer"

This ensures:

  • External links open in a new tab
  • Users remain on the blog website
  • Proper security best practices are followed

Files Modified

  • components/author-description.jsx

Fixes: keploy/keploy#3796

@dhananjay6561
Copy link
Copy Markdown
Member

Hi @agarwalpranav0711
Thanks for the PR and for spotting this!

The change fixes a very minor UI issue. Since the scope of this PR is quite small, we’d recommend exploring a slightly broader improvement or addressing a larger issue and including this fix as part of that update.

Looking forward to seeing more from you!

@dhananjay6561 dhananjay6561 requested a review from Copilot April 6, 2026 12:07
@dhananjay6561
Copy link
Copy Markdown
Member

Hey @agarwalpranav0711 👋 — thanks for putting this PR together, we appreciate the effort!

We've gone ahead and requested a Copilot review on this. Here's some context from the reviewer:

Fix is correct (external URL should use not ) but indentation is at zero while surrounding code is deeply indented.

Once you've had a chance to go through the comments, please address the feedback and resolve the threads — and we'll get this across the line. Feel free to ask if anything's unclear. Happy coding! 💙

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the author details page so the external LinkedIn URL opens in a new tab (and uses safer link attributes), preventing users from being navigated away from the blog.

Changes:

  • Replaced a Next.js <Link> usage for an external LinkedIn URL with a standard <a> tag.
  • Added target="_blank" and rel="noopener noreferrer" to the external link.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 171 to +176
{authorLinkedIn !== "n/a" && (
<div className="mt-2">
<IoLogoLinkedin className="h-5 w-5 inline mr-1" />
<Link
href={authorLinkedIn}
className="heading1 text-slate-500 hover:underline"
>
LinkedIn
</Link>
<a
href={authorLinkedIn}
target="_blank"
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

authorLinkedIn is initialized to an empty string, and the render condition only checks !== "n/a". This means the LinkedIn anchor can render with href="" on the initial render (before the effect runs), and clicking it will open a blank/new tab to the current page. Consider initializing authorLinkedIn to "n/a" (or null) and/or tightening the condition to require a non-empty URL before rendering the link.

Copilot uses AI. Check for mistakes.
Comment on lines +174 to +182
<a
href={authorLinkedIn}
target="_blank"
rel="noopener noreferrer"
className="heading1 text-slate-500 hover:underline"
>
LinkedIn
</a>

Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The newly added <a> block is not indented consistently with the surrounding JSX, which makes this section harder to read/maintain. Please align the indentation (or run the repo formatter) so it matches the existing structure inside the <div className="mt-2">.

Suggested change
<a
href={authorLinkedIn}
target="_blank"
rel="noopener noreferrer"
className="heading1 text-slate-500 hover:underline"
>
LinkedIn
</a>
<a
href={authorLinkedIn}
target="_blank"
rel="noopener noreferrer"
className="heading1 text-slate-500 hover:underline"
>
LinkedIn
</a>

Copilot uses AI. Check for mistakes.
@agarwalpranav0711
Copy link
Copy Markdown
Author

Thanks for the review and the helpful feedback! 🙌

I understand that the original issue was relatively small, and my changes expanded the scope to improve consistency across similar components. My intention was to standardize external link handling and ensure security best practices across the navigation-related parts of the codebase.

That said, I completely understand if this feels too broad for a single PR. I’m happy to:

  • Reduce the scope to only the original issue, or
  • Split this into smaller, focused PRs for easier review

Please let me know what you’d prefer, and I’ll adjust accordingly. Thanks again! 🚀

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug]: External link is opening in the same tab instead of a new tab

3 participants