Open source alternative to Semrush and Ahrefs
TypeScript backlink-analysisgoogle-search-console-mcpkeyword-researchmcpseoseo-agentseo-auditseo-automationseo-skillsseo-toolssite-audit
Show page titles on share cards for blog, Library, comparison and free tool pages (#969)
Carter Smithdb8e2794415e
diff --git a/web/package.json b/web/package.jsonindex 5c00216c..d6527bc5 100644--- a/web/package.json+++ b/web/package.json@@ -5,7 +5,7 @@"sideEffects": false,"scripts": {"dev": "vite dev",- "build": "vite build && node scripts/generate-sitemap.js",+ "build": "vite build && node scripts/generate-sitemap.js && node scripts/generate-social-cards.js","build:app": "vite build","sitemap": "node scripts/generate-sitemap.js","start": "wrangler dev",@@ -43,6 +43,7 @@"prettier": "^3.6.2","srvx": "^0.11.22","tailwindcss": "^4.1.18",+ "takumi-js": "2.13.7","typescript": "^5.9.3","vite-tsconfig-paths": "^6.0.5","vitest": "^4.1.11",diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yamlindex e1666855..59d0c8c7 100644--- a/web/pnpm-lock.yaml+++ b/web/pnpm-lock.yaml@@ -42,7 +42,7 @@ importers:version: 13.0.8([email protected](@mdx-js/[email protected])(@tanstack/[email protected]([email protected]([email protected]))([email protected]))(@types/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected]([email protected]))([email protected])([email protected]))([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))fumadocs-ui:specifier: ^16.15.8- version: 16.15.8(@types/[email protected])(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected](@mdx-js/[email protected])(@tanstack/[email protected]([email protected]([email protected]))([email protected]))(@types/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])+ version: 16.15.8(@types/[email protected])(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected](@mdx-js/[email protected])(@tanstack/[email protected]([email protected]([email protected]))([email protected]))(@types/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])([email protected]([email protected])([email protected]))react:specifier: ^19.3.0version: 19.3.0@@ -89,6 +89,9 @@ importers:tailwindcss:specifier: ^4.1.18version: 4.2.1+ takumi-js:+ specifier: 2.13.7+ version: 2.13.7([email protected])([email protected])typescript:specifier: ^5.9.3version: 5.9.3@@ -1442,6 +1445,88 @@ packages:peerDependencies:vite: ^5.2.0 || ^6 || ^7+ '@takumi-rs/[email protected]':+ resolution: {integrity: sha512-Jbe1ik4bcVOOHDpa5RCjm5fe+LfJjjyebvvPBMekhEKXg6hlTbIEFmhr/GCxMOKUfaNsvb4amZ/bVCo0NDSCjA==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [darwin]++ '@takumi-rs/[email protected]':+ resolution: {integrity: sha512-PvmSmhjbSosM3XaHZ9VhFm1x7Xc9oZ5GqXlskiwZblKIi5S4EI43buhUd28xzcBlKkB/vC3c15Cj417XjnUk4g==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [darwin]++ '@takumi-rs/[email protected]':+ resolution: {integrity: sha512-TGvDidIF3dtb7TMoJRF+0BET/v6eAuQxV8AXo/57GqO3TM9wjLt3AbkrFkzxSsaIRXlBQxCfb+GsS0YdGnpo4w==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [linux]+ libc: [glibc]++ '@takumi-rs/[email protected]':+ resolution: {integrity: sha512-CL92+JeFbqlPfWI2SSQqLtcjWpxEsPYQ+wNhaqUWLnlTMfZfj+Fl3ERFLbmK+lYnGs7bzpPXLisd3GJQ37rTYw==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [linux]+ libc: [musl]++ '@takumi-rs/[email protected]':+ resolution: {integrity: sha512-ZxoapyUDlInik93WIA9+Sk/ByOb3QGO7GaL9PA7OOdIlK5ovK9v9q88tZb1cvfxtIVzdE9HPBUhb5quNMcuXWg==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [linux]+ libc: [glibc]++ '@takumi-rs/[email protected]':+ resolution: {integrity: sha512-OqoVTd7mrlIwjKYYFizUwz+3zpnVsbrpLFPXFC+BmUxdFYNZwKa0R+Pk56EslyBZS3CuBy+RnBusHCvNC7+09g==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [linux]+ libc: [musl]++ '@takumi-rs/[email protected]':+ resolution: {integrity: sha512-evSyi/y3uV03U+PJfLeG2V3aRsmmWJ6elrFpkLtHebWwi49kXazTL5TYsCkPj5hA4i+rNs6z/t/BygLj1Krp8Q==}+ engines: {node: '>=18'}+ cpu: [arm64]+ os: [win32]++ '@takumi-rs/[email protected]':+ resolution: {integrity: sha512-GawtljFxuJemQynlF5wryxtSLv18XNuKSjMt52xf66WMaBKt4eN6/b7yIZp9QqKPof8ip8uqFOt7fWVSUN+gHQ==}+ engines: {node: '>=18'}+ cpu: [x64]+ os: [win32]++ '@takumi-rs/[email protected]':+ resolution: {integrity: sha512-FBkglt8kGBZwT2CHr+kppN+FH72Oy8gLIZz1BIbD9vNcocLrvtLsh1Y0nB18mOPmaROKGUVUXLPnIuWo49CRng==}+ engines: {node: '>=18'}+ peerDependencies:+ csstype: '*'+ peerDependenciesMeta:+ csstype:+ optional: true++ '@takumi-rs/[email protected]':+ resolution: {integrity: sha512-6AKk/ixuvoCEZD9/LPAz3kxTcwWHeZh15quhHIHYiVxFRl4x2LyKN8j6eZngiepYYsORXAuJ5YlTGA7uIRfeMQ==}+ engines: {node: '>=18'}+ peerDependencies:+ preact: ^10.0.0+ react: ^18.0.0 || ^19.0.0+ peerDependenciesMeta:+ preact:+ optional: true+ react:+ optional: true++ '@takumi-rs/[email protected]':+ resolution: {integrity: sha512-tc2IFETJ9HtZpS94cL3qSTiecJhhR4RUTXbb3E8cyz6WKdyoZSFkL2r67xnidVtcv22RKTyfVJ2gxV7eWvF+mA==}+ engines: {node: '>=20.19'}+ peerDependencies:+ csstype: '*'+ peerDependenciesMeta:+ csstype:+ optional: true+'@tanstack/[email protected]':resolution: {integrity: sha512-utTS5L2OkeYUzXGohL1Z8sefu1GLNOJcxe8Hd6iIdc/Xo1K1nDB2JEp4iSFhvYh33xKC9V91TxrS8qfrpoKobQ==}engines: {node: '>=20.19'}@@ -2755,6 +2840,10 @@ packages:resolution: {integrity: sha512-/tBrSQ36vCleJkAOsy9kbNTgaxvGbyOamC30PRePTQe/o1MFwEKHQk4Cn7BNGaPtjp+PuUrByJehM1hgxfq4sw==}+ resolution: {integrity: sha512-6CuATUv1O6X/aD3T0OQIkv0nyesefJibamskfQxcQqKVl2CCk6kIX9E0e+glMTILTJC2I1IcrcFEPlmDlcexgQ==}+ engines: {node: '>=20.19'}+resolution: {integrity: sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==}engines: {node: '>=6'}@@ -4155,6 +4244,60 @@ snapshots:tailwindcss: 4.2.1vite: 7.3.6(@types/[email protected])([email protected])([email protected])([email protected])([email protected])+ '@takumi-rs/[email protected]':+ optional: true++ '@takumi-rs/[email protected]':+ optional: true++ '@takumi-rs/[email protected]':+ optional: true++ '@takumi-rs/[email protected]':+ optional: true++ '@takumi-rs/[email protected]':+ optional: true++ '@takumi-rs/[email protected]':+ optional: true++ '@takumi-rs/[email protected]':+ optional: true++ '@takumi-rs/[email protected]':+ optional: true++ dependencies:+ '@takumi-rs/helpers': 2.13.7([email protected])+ optionalDependencies:+ '@takumi-rs/core-darwin-arm64': 2.13.7+ '@takumi-rs/core-darwin-x64': 2.13.7+ '@takumi-rs/core-linux-arm64-gnu': 2.13.7+ '@takumi-rs/core-linux-arm64-musl': 2.13.7+ '@takumi-rs/core-linux-x64-gnu': 2.13.7+ '@takumi-rs/core-linux-x64-musl': 2.13.7+ '@takumi-rs/core-win32-arm64-msvc': 2.13.7+ '@takumi-rs/core-win32-x64-msvc': 2.13.7+ csstype: 3.2.3+ transitivePeerDependencies:+ - preact+ - react++ '@takumi-rs/[email protected]([email protected])':+ optionalDependencies:+ react: 19.3.0++ dependencies:+ '@takumi-rs/helpers': 2.13.7([email protected])+ optionalDependencies:+ csstype: 3.2.3+ transitivePeerDependencies:+ - preact+ - react+'@tanstack/[email protected]': {}'@tanstack/[email protected](@tanstack/[email protected]([email protected]([email protected]))([email protected]))(@tanstack/[email protected])([email protected])([email protected]([email protected]))([email protected])':@@ -4827,7 +4970,7 @@ snapshots:transitivePeerDependencies:- supports-color- [email protected](@types/[email protected])(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected](@mdx-js/[email protected])(@tanstack/[email protected]([email protected]([email protected]))([email protected]))(@types/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected]):+ [email protected](@types/[email protected])(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected](@mdx-js/[email protected])(@tanstack/[email protected]([email protected]([email protected]))([email protected]))(@types/[email protected])(@types/[email protected])(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected]([email protected]))([email protected])([email protected]))([email protected]([email protected]))([email protected])([email protected])([email protected]([email protected])([email protected])):dependencies:'@fuma-translate/react': 1.0.2(@types/[email protected])([email protected]([email protected]))([email protected])'@fumadocs/tailwind': 0.1.1([email protected])@@ -4857,6 +5000,7 @@ snapshots:optionalDependencies:'@types/mdx': 2.0.13'@types/react': 19.2.14+ takumi-js: 2.13.7([email protected])([email protected])transitivePeerDependencies:- '@types/react-dom'- tailwindcss@@ -5928,6 +6072,16 @@ snapshots:+ dependencies:+ '@takumi-rs/core': 2.13.7([email protected])([email protected])+ '@takumi-rs/helpers': 2.13.7([email protected])+ '@takumi-rs/wasm': 2.13.7([email protected])([email protected])+ transitivePeerDependencies:+ - csstype+ - preact+ - react+diff --git a/web/scripts/generate-social-cards.js b/web/scripts/generate-social-cards.jsnew file mode 100644index 00000000..a7552dd9--- /dev/null+++ b/web/scripts/generate-social-cards.js@@ -0,0 +1,133 @@+#!/usr/bin/env node++// Renders the title share cards that buildPageSeo (src/lib/seo.ts) points+// opted-in pages at. Runs after the prerender, so the built HTML is the single+// source of truth: every page whose og:image is under /og/ gets a PNG with its+// og:image:alt text as the title.++import { mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";+import { dirname, join } from "node:path";+import { fileURLToPath } from "node:url";+import { createElement as h } from "react";+import { render } from "takumi-js";++const __dirname = dirname(fileURLToPath(import.meta.url));+const DIST_DIR = join(__dirname, "../dist/client");+const LOGO = `data:image/png;base64,${readFileSync(+ join(__dirname, "../public/android-chrome-192x192.png"),+).toString("base64")}`;++function readMeta(html, property) {+ const match = html.match(+ new RegExp(`<meta property="${property}" content="([^"]*)"`),+ );+ return match ? decodeEntities(match[1]) : null;+}++// React escapes attribute values with exactly these entities.+function decodeEntities(value) {+ return value+ .replace(/'/g, "'")+ .replace(/"/g, '"')+ .replace(/</g, "<")+ .replace(/>/g, ">")+ .replace(/&/g, "&");+}++// Matches the report share card (src/server/features/reports/reportSocialImage.tsx).+function card(title) {+ return h(+ "div",+ {+ style: {+ width: "100%",+ height: "100%",+ position: "relative",+ display: "flex",+ flexDirection: "column",+ padding: 64,+ backgroundColor: "#f5f4ef",+ color: "#1d2925",+ },+ },+ h(+ "div",+ { style: { display: "flex", alignItems: "center", gap: 20 } },+ h("img", {+ src: LOGO,+ width: 64,+ height: 64,+ style: { borderRadius: 14 },+ }),+ h(+ "div",+ { style: { fontSize: 34, fontWeight: 600, letterSpacing: -1 } },+ "OpenSEO",+ ),+ ),+ h(+ "div",+ {+ style: {+ display: "flex",+ flex: 1,+ alignItems: "center",+ paddingTop: 24,+ },+ },+ h(+ "div",+ {+ style: {+ fontSize: title.length > 85 ? 54 : title.length > 48 ? 64 : 80,+ fontWeight: 700,+ letterSpacing: -2,+ lineHeight: 1.12,+ overflowWrap: "anywhere",+ },+ },+ title,+ ),+ ),+ h(+ "div",+ {+ style: {+ position: "absolute",+ right: 64,+ bottom: 28,+ fontSize: 24,+ color: "#65716b",+ },+ },+ "openseo.so",+ ),+ );+}++const cards = new Map();+const htmlFiles = readdirSync(DIST_DIR, { recursive: true }).filter((file) =>+ file.endsWith(".html"),+);+for (const file of htmlFiles) {+ const html = readFileSync(join(DIST_DIR, file), "utf8");+ const image = readMeta(html, "og:image");+ const title = readMeta(html, "og:image:alt");+ if (!image || !title) continue;+ const { pathname } = new URL(image);+ if (pathname.startsWith("/og/")) cards.set(pathname, title);+}++for (const [pathname, title] of cards) {+ const png = await render(card(title), {+ width: 1200,+ height: 630,+ format: "png",+ emoji: "from-font",+ });+ const outFile = join(DIST_DIR, pathname);+ mkdirSync(dirname(outFile), { recursive: true });+ writeFileSync(outFile, png);+}++console.log(`Generated ${cards.size} social cards`);diff --git a/web/src/lib/seo.ts b/web/src/lib/seo.tsindex 0ccdb542..d3abbe8a 100644--- a/web/src/lib/seo.ts+++ b/web/src/lib/seo.ts@@ -1,3 +1,5 @@+import { FREE_TOOL_PATHS } from "@/lib/free-tools/free-tool-paths";+const DEFAULT_SITE_URL = "https://openseo.so";const DEFAULT_SOCIAL_IMAGE_PATH = "/social-card.jpg";const DEFAULT_SOCIAL_IMAGE_ALT = "OpenSEO product preview";@@ -19,6 +21,29 @@ export function toCanonicalUrl(path: string): string {return new URL(toCanonicalPath(path), `${SITE_URL}/`).href;}+// Pages whose share preview shows the page title on an OpenSEO card instead+// of the generic product card. An entry ending in "/" covers every page+// below it, but not the index page itself. scripts/generate-social-cards.js+// renders the cards from the built HTML.+const TITLE_CARD_PATHS = [+ "/blogs/",+ "/library/",+ "/openseo-vs-dataforseo",+ "/semrush-alternative",+ "/semrush-pricing",+ "/ahrefs-alternative",+ "/ahrefs-pricing",+ ...Object.values(FREE_TOOL_PATHS),+];++function hasTitleCard(canonicalPath: string): boolean {+ return TITLE_CARD_PATHS.some((entry) =>+ entry.endsWith("/")+ ? canonicalPath.startsWith(entry)+ : canonicalPath === entry,+ );+}+export function buildBreadcrumbJsonLd(items: Array<{ name: string; path: string }>,) {@@ -49,11 +74,19 @@ export function buildPageSeo({description,titleSuffix,ogType = "website",- imageAlt = DEFAULT_SOCIAL_IMAGE_ALT,+ imageAlt,}: BuildSeoParams) {const fullTitle = titleSuffix ? `${title} - ${titleSuffix}` : title;- const canonicalUrl = toCanonicalUrl(path);- const socialImageUrl = toCanonicalUrl(DEFAULT_SOCIAL_IMAGE_PATH);+ const canonicalPath = toCanonicalPath(path);+ const canonicalUrl = toCanonicalUrl(canonicalPath);+ const titleCard = hasTitleCard(canonicalPath);+ const socialImageUrl = toCanonicalUrl(+ titleCard ? `/og${canonicalPath}.png` : DEFAULT_SOCIAL_IMAGE_PATH,+ );+ // The card generator reads the card's title from this alt text.+ const socialImageAlt = titleCard+ ? title+ : (imageAlt ?? DEFAULT_SOCIAL_IMAGE_ALT);return {meta: [@@ -67,8 +100,11 @@ export function buildPageSeo({: []),{ property: "og:url", content: canonicalUrl },{ property: "og:image", content: socialImageUrl },- { property: "og:image:alt", content: imageAlt },- { property: "og:image:type", content: "image/jpeg" },+ { property: "og:image:alt", content: socialImageAlt },+ {+ property: "og:image:type",+ content: titleCard ? "image/png" : "image/jpeg",+ },{ property: "og:image:width", content: "1200" },{ property: "og:image:height", content: "630" },{ name: "twitter:card", content: "summary_large_image" },@@ -77,7 +113,7 @@ export function buildPageSeo({? [{ name: "twitter:description", content: description }]: []),{ name: "twitter:image", content: socialImageUrl },- { name: "twitter:image:alt", content: imageAlt },+ { name: "twitter:image:alt", content: socialImageAlt },],links: [{ rel: "canonical", href: canonicalUrl }],};diff --git a/web/src/routes/_marketing/backlink-checker.tsx b/web/src/routes/_marketing/backlink-checker.tsxindex cc7e39eb..cff9b1a3 100644--- a/web/src/routes/_marketing/backlink-checker.tsx+++ b/web/src/routes/_marketing/backlink-checker.tsx@@ -17,7 +17,6 @@ export const Route = createFileRoute("/_marketing/backlink-checker")({"Check backlinks for any domain: referring domains, top backlinks, anchor text, and follow status. Instant results, no signup, no email.",path: TOOL.path,titleSuffix: "OpenSEO",- imageAlt: "OpenSEO free backlink checker",}),component: BacklinkCheckerPage,});diff --git a/web/src/routes/_marketing/competitor-analysis.tsx b/web/src/routes/_marketing/competitor-analysis.tsxindex 56f65354..4c28b022 100644--- a/web/src/routes/_marketing/competitor-analysis.tsx+++ b/web/src/routes/_marketing/competitor-analysis.tsx@@ -14,7 +14,6 @@ export const Route = createFileRoute("/_marketing/competitor-analysis")({"See a competitor's top organic keywords and pages, compare their traffic to yours, and find the keywords they rank for that you don't. No signup, no email.",path: TOOL.path,titleSuffix: "OpenSEO",- imageAlt: "OpenSEO free SEO competitor analysis tool",}),component: CompetitorAnalysisPage,});diff --git a/web/src/routes/_marketing/competitor-keyword-finder.tsx b/web/src/routes/_marketing/competitor-keyword-finder.tsxindex 71e17ceb..63d7cfce 100644--- a/web/src/routes/_marketing/competitor-keyword-finder.tsx+++ b/web/src/routes/_marketing/competitor-keyword-finder.tsx@@ -12,7 +12,6 @@ export const Route = createFileRoute("/_marketing/competitor-keyword-finder")({"Find the keywords a competitor ranks for on Google, with search volumes, ranking positions, and the pages that rank. Enter a domain to get started.",path: TOOL.path,titleSuffix: "OpenSEO",- imageAlt: "Free Competitor Keyword Finder",}),component: Page,});diff --git a/web/src/routes/_marketing/domain-age-checker.tsx b/web/src/routes/_marketing/domain-age-checker.tsxindex 087fe963..a9778b79 100644--- a/web/src/routes/_marketing/domain-age-checker.tsx+++ b/web/src/routes/_marketing/domain-age-checker.tsx@@ -14,7 +14,6 @@ export const Route = createFileRoute("/_marketing/domain-age-checker")({"Check when a domain was registered, how old it is, when it expires, and who the registrar is — up to 10 domains at once. No signup, no email.",path: TOOL.path,titleSuffix: "OpenSEO",- imageAlt: "OpenSEO free domain age checker",}),component: DomainAgeCheckerPage,});diff --git a/web/src/routes/_marketing/keyword-generator.tsx b/web/src/routes/_marketing/keyword-generator.tsxindex 303ced89..adda98e0 100644--- a/web/src/routes/_marketing/keyword-generator.tsx+++ b/web/src/routes/_marketing/keyword-generator.tsx@@ -12,7 +12,6 @@ export const Route = createFileRoute("/_marketing/keyword-generator")({"Start with a topic and find keyword ideas people search for. Compare estimated search volume and difficulty in your target country.",path: TOOL.path,titleSuffix: "OpenSEO",- imageAlt: "Free Keyword Generator",}),component: Page,});diff --git a/web/src/routes/_marketing/serp-simulator.tsx b/web/src/routes/_marketing/serp-simulator.tsxindex 19031c0b..34008b2a 100644--- a/web/src/routes/_marketing/serp-simulator.tsx+++ b/web/src/routes/_marketing/serp-simulator.tsx@@ -15,7 +15,6 @@ export const Route = createFileRoute("/_marketing/serp-simulator")({"Preview your title and meta description in desktop and mobile search results, with pixel measurements and approximate truncation. No signup, no email.",path: TOOL.path,titleSuffix: "OpenSEO",- imageAlt: "OpenSEO free SERP snippet simulator",}),component: SerpSimulatorPage,});diff --git a/web/src/routes/_marketing/spam-score-checker.tsx b/web/src/routes/_marketing/spam-score-checker.tsxindex aed39ce7..2bdb4685 100644--- a/web/src/routes/_marketing/spam-score-checker.tsx+++ b/web/src/routes/_marketing/spam-score-checker.tsx@@ -14,7 +14,6 @@ export const Route = createFileRoute("/_marketing/spam-score-checker")({"Check a domain's backlink spam score and see the spammiest links pointing at it. No signup, no email.",path: TOOL.path,titleSuffix: "OpenSEO",- imageAlt: "OpenSEO free backlink spam score checker",}),component: SpamScoreCheckerPage,});diff --git a/web/src/routes/_marketing/website-traffic-checker.tsx b/web/src/routes/_marketing/website-traffic-checker.tsxindex 54f6c559..aa26937c 100644--- a/web/src/routes/_marketing/website-traffic-checker.tsx+++ b/web/src/routes/_marketing/website-traffic-checker.tsx@@ -15,7 +15,6 @@ export const Route = createFileRoute("/_marketing/website-traffic-checker")({"Estimate any website's organic traffic, keyword count, and traffic value, with its top keywords and pages. Compare two domains. No signup, no email.",path: TOOL.path,titleSuffix: "OpenSEO",- imageAlt: "OpenSEO free website traffic checker",}),component: WebsiteTrafficCheckerPage,});