Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/(landing)/_components/landing-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const monoDisplayClassName = "font-[family-name:var(--font-mono-display)]";

type LandingNavItem = {
href: string;
labelKey: "comparison" | "docs" | "github" | "playground" | "pricing";
labelKey: "comparison" | "docs" | "github" | "playground" | "pricing" | "blog";
external?: boolean;
};

Expand All @@ -27,6 +27,7 @@ const landingNavItems: LandingNavItem[] = [
{ href: "#pricing", labelKey: "pricing" },
{ href: "https://docs.knowhereto.ai/", labelKey: "docs", external: true },
{ href: "/github", labelKey: "github" },
{ href: "https://blog.knowhereto.ai/", labelKey: "blog", external: true },
];
Comment on lines 27 to 31

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Updated LandingTrackedLink and LandingTrackedAnchor to use rel="noopener noreferrer" for all external links via a shared externalLinkRel constant, so Blog (and Docs/Playground) no longer expose window.opener.


const localeLabels = {
Expand All @@ -35,6 +36,7 @@ const localeLabels = {
} as const;

const landingNavCtaIds: Record<LandingNavItem["labelKey"], string> = {
blog: "blog_external",
comparison: "comparison",
docs: "docs",
github: "github",
Expand Down
6 changes: 4 additions & 2 deletions app/(landing)/_components/landing-tracked-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ type LandingTrackedButtonProps = {

const isContactSalesCta = (ctaId: string) => ctaId === "contact_sales" || ctaId === "book_demo";

const externalLinkRel = "noopener noreferrer";

const trackCta = (ctaId: string, sourceSection: string, locale: string, href?: string) => {
if (isContactSalesCta(ctaId)) {
trackContactSalesClicked(sourceSection);
Expand Down Expand Up @@ -72,7 +74,7 @@ export const LandingTrackedLink = ({
className={className}
href={href}
onClick={handleClick}
rel={external ? "noreferrer" : undefined}
rel={external ? externalLinkRel : undefined}
target={external ? "_blank" : undefined}
>
{children}
Expand Down Expand Up @@ -101,7 +103,7 @@ export const LandingTrackedAnchor = ({
className={className}
href={href}
onClick={handleClick}
rel={external ? "noreferrer" : undefined}
rel={external ? externalLinkRel : undefined}
target={external ? "_blank" : undefined}
>
{children}
Expand Down
3 changes: 2 additions & 1 deletion i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,8 @@
"playground": "Playground",
"pricing": "Pricing",
"docs": "Docs",
"github": "GitHub"
"github": "GitHub",
"blog": "Blog"
},
"cta": "GET API KEY",
"openNavigationMenu": "Open navigation menu"
Expand Down
3 changes: 2 additions & 1 deletion i18n/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,8 @@
"playground": "在线体验",
"pricing": "价格",
"docs": "文档",
"github": "GitHub"
"github": "GitHub",
"blog": "博客"
},
"cta": "获取 API Key",
"openNavigationMenu": "打开导航菜单"
Expand Down
8 changes: 8 additions & 0 deletions lib/landing-figma-design.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ describe("landing contracts", () => {
'{ href: "https://notebook.knowhereto.ai", labelKey: "playground", external: true }'
);
expect(landingHeaderSource).toContain('{ href: "/github", labelKey: "github" }');
expect(landingHeaderSource).toContain(
'{ href: "https://blog.knowhereto.ai/", labelKey: "blog", external: true }'
);
expect(landingHeaderSource.indexOf('{ href: "/github", labelKey: "github" }')).toBeLessThan(
landingHeaderSource.indexOf(
'{ href: "https://blog.knowhereto.ai/", labelKey: "blog", external: true }'
)
);
});

it("keeps the playground sample area annotated with the drag-to-parse cue", () => {
Expand Down
Loading