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
12 changes: 10 additions & 2 deletions app/en/resources/contact-us/contact-cards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
Users,
} from "lucide-react";
import posthog from "posthog-js";
import { useState } from "react";
import { useEffect, useState } from "react";
import { useForm } from "react-hook-form";
import { QuickStartCard } from "../../../_components/quick-start-card";

Expand Down Expand Up @@ -264,6 +264,14 @@ function SuccessMessage({ onClose }: { onClose: () => void }) {
export function ContactCards() {
const [isSalesModalOpen, setIsSalesModalOpen] = useState(false);
const [isSubmitted, setIsSubmitted] = useState(false);
// Assemble the support mailto only after mount so the SSR/crawled markup
// shows a plain contact-page link — Cloudflare's email obfuscation then has
// nothing to rewrite into a broken /cdn-cgi/l/email-protection link. Mirrors
// <ContactEmail> (see app/_components/contact-email.tsx).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thank you for this note! 🙏 that makes sense and is useful to know why we are doing it.

const [supportHref, setSupportHref] = useState("/en/resources/contact-us");
useEffect(() => {
setSupportHref("mailto:support@arcade.dev");
}, []);

const handleContactSalesClick = () => {
posthog.capture("Contact sales modal opened", {
Expand All @@ -282,7 +290,7 @@ export function ContactCards() {
<div className="mt-16 grid gap-8 md:grid-cols-2 lg:grid-cols-3">
<QuickStartCard
description="Get help with technical issues, account questions, and general inquiries from our support team. Email support is available for customers on paid plans."
href="mailto:support@arcade.dev"
href={supportHref}
icon={Mail}
title="Email Support"
/>
Expand Down
7 changes: 7 additions & 0 deletions next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ const nextConfig: NextConfig = withLlmsTxt({
destination: "/:locale/resources/integrations",
permanent: true,
},
// The auth provider is "square"; an external/stale link points at the
// old "squareup" slug, which 404s. Send it to the real page.
{
source: "/:locale/references/auth-providers/squareup",
destination: "/:locale/references/auth-providers/square",
permanent: true,
},
// Dissolved guides/security section
{
source: "/:locale/guides/security/security-research-program",
Expand Down
102 changes: 101 additions & 1 deletion tests/integration-index-links.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ import {
resolveIndexToolkits,
toIntegrationLink,
} from "@/app/_lib/integration-index";
import type { ToolkitWithDocsLink } from "@/app/_lib/toolkit-slug";
import { readToolkitData } from "@/app/_lib/toolkit-data";
import {
getToolkitSlug,
type ToolkitWithDocsLink,
} from "@/app/_lib/toolkit-slug";
import {
INTEGRATION_CATEGORIES,
listToolkitRoutes,
listValidIntegrationLinks,
} from "@/app/_lib/toolkit-static-params";

Expand Down Expand Up @@ -246,3 +251,98 @@ describe("hardcoded internal links in toolkit components resolve", () => {
TIMEOUT
);
});

// ---------------------------------------------------------------------------
// Toolkit page canonical hygiene
//
// docs' only page-level <link rel="canonical"> comes from the generated toolkit
// pages (toolkit-docs-page.tsx → generateMetadata, which emits
// `/en/resources/integrations/<category>/<getToolkitSlug(data)>`). This guards
// that canonical class — the docs analog of the www canonical guard, and
// specifically the "Duplicate pages without canonical" finding MARTECH-19 fixed
// (notion): every toolkit page's canonical points at its own URL, canonicals are
// unique (no two pages share one), and none points at a redirect source or a
// non-generated route. We re-derive the canonical with the same pure helpers the
// page uses (listToolkitRoutes + readToolkitData + getToolkitSlug) rather than
// importing the page module, which pulls in browser-only render code.
//
// (The docs sitemap — app/sitemap.ts, static MDX pages only — is guarded in
// tests/sitemap.test.ts: no redirect-source URLs, no duplicates.)
// ---------------------------------------------------------------------------

describe("toolkit page canonical hygiene", () => {
let canonicals: Array<{ page: string; canonical: string }>;
let validLinks: Set<string>;
let redirectSources: Set<string>;

beforeAll(async () => {
[validLinks, redirectSources] = await Promise.all([
listValidIntegrationLinks(),
readRedirectSources(),
]);
canonicals = [];
// Fetch the route list ONCE. getToolkitStaticParamsForCategory() recomputes
// listToolkitRoutes() (toolkit index + every data file) internally, so
// looping it over all categories re-read the whole catalog once per category.
// listToolkitRoutes() already yields both category and toolkitId.
for (const { category, toolkitId } of await listToolkitRoutes()) {
const data = await readToolkitData(toolkitId);
const canonical = data
? `${INTEGRATIONS}/${category}/${getToolkitSlug({
id: data.id,
docsLink: data.metadata?.docsLink,
})}`
: "";
canonicals.push({
page: `${INTEGRATIONS}/${category}/${toolkitId}`,
canonical,
});
}
}, TIMEOUT);

test("every generated toolkit page emits a canonical", () => {
expect(canonicals.length).toBeGreaterThan(0);
expect(canonicals.filter((c) => !c.canonical).map((c) => c.page)).toEqual(
[]
);
});

test("each toolkit canonical points at the page's own URL", () => {
const mismatched = canonicals
.filter((c) => c.canonical && c.canonical !== c.page)
.map((c) => `${c.page} → ${c.canonical}`);
expect(mismatched).toEqual([]);
});

test("toolkit canonicals are unique (no duplicate-canonical pages)", () => {
const byCanonical = new Map<string, string>();
const duplicates: string[] = [];
for (const { page, canonical } of canonicals) {
if (!canonical) {
continue;
}
const prior = byCanonical.get(canonical);
if (prior) {
duplicates.push(`${canonical} ← ${prior} + ${page}`);
} else {
byCanonical.set(canonical, page);
}
}
expect(duplicates).toEqual([]);
});

test("no toolkit canonical points at a redirect or a missing route", () => {
const offenders: string[] = [];
for (const { canonical } of canonicals) {
if (!canonical) {
continue;
}
if (redirectSources.has(toLocaleParam(canonical))) {
offenders.push(`${canonical}: redirect source`);
} else if (!validLinks.has(withEnLocale(canonical))) {
offenders.push(`${canonical}: not a generated route`);
}
}
expect(offenders).toEqual([]);
});
Comment on lines +334 to +347
});
Loading