diff --git a/web/README.md b/web/README.md index 6395b2c..7ad1548 100644 --- a/web/README.md +++ b/web/README.md @@ -5,7 +5,8 @@ A [Cloudflare Worker](https://developers.cloudflare.com/workers/) that puts a sitemaps.org-compliant `sitemap.xml` to copy or download. - `GET /` — the page (`page.js`), bilingual **en/it** (auto-detected from `Accept-Language`; `/en` · `/it` force a locale) -- `GET /og.png` · `GET /favicon.svg` — Open Graph share image (1200×630) + favicon +- `GET /og.png` · `GET /favicon.png` (also `/favicon.ico`, `/favicon.svg`, `/apple-touch-icon.png`) — Open Graph share image (1200×630) + GeoSuite's favicon +- `GET /logos/{chatgpt,gemini,perplexity}.svg` — engine logos for the call to action - `GET /api/crawl?url=https://example.com` — `{ site, count, capped, xml }` > ⚠️ **Capped edge version.** The crawl is a small BFS (≤40 pages, depth ≤2) diff --git a/web/apple-touch-icon.png b/web/apple-touch-icon.png new file mode 100644 index 0000000..530c184 Binary files /dev/null and b/web/apple-touch-icon.png differ diff --git a/web/favicon.png b/web/favicon.png new file mode 100644 index 0000000..9a612c7 Binary files /dev/null and b/web/favicon.png differ diff --git a/web/logos/chatgpt.svg b/web/logos/chatgpt.svg new file mode 100644 index 0000000..2312a77 --- /dev/null +++ b/web/logos/chatgpt.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/web/logos/gemini.svg b/web/logos/gemini.svg new file mode 100644 index 0000000..ecc24b6 --- /dev/null +++ b/web/logos/gemini.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/web/logos/perplexity.svg b/web/logos/perplexity.svg new file mode 100644 index 0000000..5f5a5ab --- /dev/null +++ b/web/logos/perplexity.svg @@ -0,0 +1 @@ +Perplexity \ No newline at end of file diff --git a/web/page.js b/web/page.js index f8269ee..fd6ecad 100644 --- a/web/page.js +++ b/web/page.js @@ -3,62 +3,115 @@ // dictionary below. The interactive crawl form talks to /api/crawl and renders the // result; its visitor-visible strings are injected as I18N and read at runtime. // +// It wears GeoSuite's design (theme.js, shared with the hub at tools.trygeosuite.it): +// same bar, hero, panels and closing call to action, so the free tools read as +// one site. Icons are inline line SVGs, never emoji, and a state is always +// spelled out in text next to its color. +// // Product names and "sitemap.xml" stay as-is; only prose/labels/buttons translate. +import { FONTS, BASE_CSS, ENGINES } from './theme.js'; + const BASE = 'https://sitemap-builder.geosuite.workers.dev'; +const HUB = 'https://tools.trygeosuite.it'; +const REPO = 'https://github.com/TryGeoSuite/sitemap-builder'; +const NPM = 'https://www.npmjs.com/package/@geosuite/sitemap-builder'; +const ANALYSIS = 'https://trygeosuite.it/analisi-gratuita?utm_source=geosuite-open&utm_medium=tool&utm_campaign=sitemap-builder'; +const CMD = 'npx @geosuite/sitemap-builder <url>'; + +// Filled circle + white mark, colored by the surrounding state class. Always +// next to a text label, never the only signal. +const ICONS = { + ok: '', + warn: '', + crit: '', +}; +const STAR = ''; const S = { en: { - title: 'Sitemap Builder — generate a sitemap.xml by crawling your site', + title: 'Sitemap Builder: generate a sitemap.xml by crawling your site', desc: 'Paste a URL and get a sitemaps.org-compliant sitemap.xml by crawling your site. Free, capped quick version; use the CLI for a full crawl.', - h1: 'Sitemap Builder', - lead: `Paste a URL — we crawl your site and build a sitemap.xml you can copy or download.`, - promo: `Built by GeoSuite — the AI-visibility platform that measures & improves how ChatGPT, Gemini, Claude & Perplexity describe your brand.`, - promoCta: 'Explore GeoSuite →', - star: '★ Star on GitHub', - placeholder: 'https://example.com', - build: 'Build', + nav: 'Site', + tools: 'Free tools', + eyebrow: 'Sitemap Builder, a free GeoSuite tool', + h1: 'Turn your site into a sitemap.xml', + lead: `Paste a URL: we crawl your site and build a sitemap.xml you can copy or download.`, + label: 'Your website', + placeholder: 'yoursite.com', + build: 'Build the sitemap', + facts: ['Free', 'No sign-up', 'Open source (MIT)', 'sitemaps.org compliant'], + howLabel: 'How it works', + how: [ + 'We start from the page you paste and follow the links that stay on your site.', + 'Up to ~40 pages, two clicks deep, so the answer comes back in seconds.', + 'You get a valid sitemap.xml to copy or download, ready for your site root.', + ], + cliLabel: 'From the terminal', hintPre: 'Quick crawl, capped at ~40 pages (depth 2) to stay fast. For a full crawl of a large site, use the CLI:', - footerOss: 'Open source (MIT):', - footerBuilt: `Built by Matteo Perino · a GeoSuite open-source tool.`, + copyCmd: 'Copy', + copiedCmd: 'Copied', + copyLabel: 'Copy the command', + star: 'Star on GitHub', + ctaTitle: 'Being found is step one. Being recommended is the goal.', + ctaText: 'A sitemap.xml helps crawlers, AI ones included, find every page you want read. GeoSuite checks what happens next: it asks ChatGPT, Gemini and Perplexity the questions your customers really ask, and tells you where you appear, who wins instead and what to fix first. The report arrives by email.', + ctaButton: 'Get the free analysis', + footer: `Open source (MIT) by Matteo Perino, maintained under GeoSuite, the Italian platform for AI visibility. Code on GitHub, package on npm.`, // Strings read at runtime by the interactive crawl script. js: { crawling: 'Crawling', crawlingTail: '… (up to ~40 pages)', - networkError: 'Network error — try again.', - cappedPre: '⚠️ Capped at', + networkError: 'Network error, try again.', + cappedPre: 'Capped at', cappedPost: 'pages (the edge version stays fast). Run the CLI for a full crawl.', sitemapFor: 'sitemap.xml for', + page: 'page', pages: 'pages', copy: 'Copy', - copied: 'Copied ✓', + copied: 'Copied', download: 'Download', }, }, it: { - title: 'Sitemap Builder — genera un sitemap.xml esplorando il tuo sito', + title: 'Sitemap Builder: genera un sitemap.xml esplorando il tuo sito', desc: 'Incolla un URL e ottieni un sitemap.xml conforme a sitemaps.org esplorando il tuo sito. Versione rapida e limitata gratuita; usa la CLI per un crawl completo.', - h1: 'Sitemap Builder', - lead: `Incolla un URL — esploriamo il tuo sito e costruiamo un sitemap.xml che puoi copiare o scaricare.`, - promo: `Creato da GeoSuite — la piattaforma di visibilità AI che misura e migliora come ChatGPT, Gemini, Claude e Perplexity descrivono il tuo brand.`, - promoCta: 'Scopri GeoSuite →', - star: '★ Stella su GitHub', - placeholder: 'https://esempio.com', - build: 'Costruisci', + nav: 'Sito', + tools: 'Strumenti gratuiti', + eyebrow: 'Sitemap Builder, uno strumento gratuito di GeoSuite', + h1: 'Trasforma il tuo sito in un sitemap.xml', + lead: `Incolla un URL: esploriamo il tuo sito e costruiamo un sitemap.xml che puoi copiare o scaricare.`, + label: 'Il tuo sito', + placeholder: 'tuosito.it', + build: 'Costruisci la sitemap', + facts: ['Gratis', 'Senza registrazione', 'Open source (MIT)', 'Conforme a sitemaps.org'], + howLabel: 'Come funziona', + how: [ + 'Partiamo dalla pagina che incolli e seguiamo i link che restano sul tuo sito.', + 'Fino a ~40 pagine, a due clic di profondità, così la risposta arriva in pochi secondi.', + 'Ottieni un sitemap.xml valido da copiare o scaricare, pronto per la radice del sito.', + ], + cliLabel: 'Dal terminale', hintPre: 'Crawl rapido, limitato a ~40 pagine (profondità 2) per restare veloce. Per un crawl completo di un sito grande, usa la CLI:', - footerOss: 'Open source (MIT):', - footerBuilt: `Creato da Matteo Perino · uno strumento open-source di GeoSuite.`, + copyCmd: 'Copia', + copiedCmd: 'Copiato', + copyLabel: 'Copia il comando', + star: 'Stella su GitHub', + ctaTitle: 'Farsi trovare è il primo passo. Farsi consigliare è l’obiettivo.', + ctaText: 'Un sitemap.xml aiuta i crawler, anche quelli delle AI, a trovare tutte le pagine che vuoi far leggere. GeoSuite controlla cosa succede dopo: fa a ChatGPT, Gemini e Perplexity le domande che i tuoi clienti fanno davvero, e ti dice dove compari, chi vince al posto tuo e cosa correggere per primo. Il report arriva via mail.', + ctaButton: 'Richiedi l’analisi gratuita', + footer: `Open source (MIT) di Matteo Perino, mantenuto da GeoSuite, la piattaforma italiana per la visibilità sulle AI. Codice su GitHub, pacchetto su npm.`, // Stringhe lette a runtime dallo script interattivo del crawl. js: { crawling: 'Esplorazione di', crawlingTail: '… (fino a ~40 pagine)', - networkError: 'Errore di rete — riprova.', - cappedPre: '⚠️ Limitato a', + networkError: 'Errore di rete, riprova.', + cappedPre: 'Limitato a', cappedPost: 'pagine (la versione edge resta veloce). Lancia la CLI per un crawl completo.', sitemapFor: 'sitemap.xml per', + page: 'pagina', pages: 'pagine', copy: 'Copia', - copied: 'Copiato ✓', + copied: 'Copiato', download: 'Scarica', }, }, @@ -79,7 +132,8 @@ export function renderPage(lang) { - + + @@ -93,101 +147,106 @@ export function renderPage(lang) { +${FONTS}
- -
-

🗺️ ${t.h1}

-

${t.lead}

+
+ GeoSuite +
-
-
${t.promo}
-
- ${t.promoCta} - ${t.star} +
+
+
+

${t.eyebrow}

+

${t.h1}

+

${t.lead}

+
+ + + +
+
    ${t.facts.map((f) => `
  • ${ICONS.ok}${f}
  • `).join('')}
+
+ +
-
- -
- - -
-

${t.hintPre} npx @geosuite/sitemap-builder <url>

- -
- -
- ${t.footerOss} GitHub - · npm - · npx @geosuite/sitemap-builder <url>
- ${t.footerBuilt} -
+ +
+ +
+
+

${t.ctaTitle}

+

${t.ctaText}

+ ${ENGINES} +
+ ${t.ctaButton} +
+ + +
${t.footer}
- + + `; } diff --git a/web/theme.js b/web/theme.js new file mode 100644 index 0000000..2ddeba0 --- /dev/null +++ b/web/theme.js @@ -0,0 +1,120 @@ +// Visual layer copied from TryGeoSuite/geo-toolkit/theme.js (the hub at +// tools.trygeosuite.it and its AI Readiness Check), so this tool reads as part +// of the same site. Keep it in step with that file: change it there first, then +// copy it here unchanged except for this comment. +// +// It follows GeoSuite's design system (geo/design-system/geosuite/MASTER.md): +// Inter, flat surfaces with one-pixel lines, magenta only for the primary action +// and the visitor's own row, semantic colors always paired with text or an icon, +// light and dark both first-class. The brand is text, like GeoSuite's own +// header: the official wordmark is white on transparent and must not be +// recolored for the light theme. + +export const FONTS = ` + +`; + +// Tokens, page chrome (bar, hero, footer) and the components both pages use: +// the URL form, panels, the ranked list, the GeoSuite call to action. +export const BASE_CSS = ` + :root { + --bg:#f4f5f7; --surface:#fff; --surface-2:#f8f9fb; --sunk:#eef0f3; + --ink:#111318; --ink-2:#424854; --ink-3:#596474; + --line:#e5e7eb; --line-2:#d8dce2; + --accent:#e0327d; --accent-deep:#b81862; --accent-soft:#fdeaf3; --accent-ink:#a3105a; --on-accent:#fff; + --ok:#127348; --ok-soft:#e7f6ec; --warn:#875000; --warn-soft:#fbf1de; --crit:#bd2838; --crit-soft:#fdeaeb; + --shadow:0 1px 2px rgba(17,19,24,.06); + } + @media (prefers-color-scheme: dark) { + :root { + --bg:#111318; --surface:#181b21; --surface-2:#20242c; --sunk:#0d0f13; + --ink:#f5f7fa; --ink-2:#c5cad3; --ink-3:#979eaa; + --line:#282d36; --line-2:#353c48; + --accent:#f2529a; --accent-deep:#b81862; --accent-soft:#2a1420; --accent-ink:#f7a6cb; + --ok:#39c877; --ok-soft:#12241a; --warn:#e0a53c; --warn-soft:#27200f; --crit:#f0666d; --crit-soft:#2a1416; + --shadow:0 1px 2px rgba(0,0,0,.28); + } + } + * { box-sizing:border-box; } + html { -webkit-text-size-adjust:100%; } + body { margin:0; background:var(--bg); color:var(--ink); font:16px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing:antialiased; } + a { color:var(--accent-ink); } + :focus-visible { outline:2px solid var(--accent); outline-offset:2px; border-radius:4px; } + .wrap { max-width:880px; margin:0 auto; padding:0 16px 64px; } + + .bar { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px 0; } + .brand { color:var(--ink); text-decoration:none; font-size:19px; font-weight:700; letter-spacing:-.035em; } + .bar nav { display:flex; align-items:center; gap:4px; font-size:.875rem; } + .bar nav a { color:var(--ink-3); text-decoration:none; padding:6px 10px; border-radius:8px; min-height:32px; display:inline-flex; align-items:center; } + .bar nav a:hover { color:var(--ink); background:var(--sunk); } + .bar nav a[aria-current="page"] { color:var(--ink); background:var(--surface); box-shadow:inset 0 0 0 1px var(--line); } + + .hero { display:grid; grid-template-columns:1fr; gap:32px; padding:40px 0 8px; align-items:start; } + @media (min-width:900px) { .wrap { max-width:1080px; } .hero { grid-template-columns:1.15fr 1fr; gap:48px; } } + .eyebrow { display:inline-block; font-size:.8125rem; font-weight:600; color:var(--accent-ink); background:var(--accent-soft); padding:4px 10px; border-radius:999px; margin:0 0 16px; } + h1 { font-size:clamp(2rem, 4.6vw, 3rem); line-height:1.08; letter-spacing:-.03em; margin:0 0 14px; text-wrap:balance; } + .lead { color:var(--ink-2); font-size:1.125rem; margin:0 0 24px; max-width:48ch; } + .urlform { display:flex; gap:8px; } + .urlform label { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); } + input { flex:1; min-width:0; height:52px; background:var(--surface); border:1px solid var(--line-2); color:var(--ink); border-radius:8px; padding:0 16px; font:inherit; font-size:1.0625rem; } + input::placeholder { color:var(--ink-3); } + button { font:inherit; cursor:pointer; } + .primary { height:52px; padding:0 22px; border:0; border-radius:8px; background:var(--accent-deep); color:var(--on-accent); font-weight:600; white-space:nowrap; min-width:150px; } + .primary:hover { background:#9a1352; } + .primary[disabled] { opacity:.65; cursor:progress; } + .facts { display:flex; flex-wrap:wrap; gap:6px 16px; list-style:none; margin:14px 0 0; padding:0; color:var(--ink-3); font-size:.875rem; } + .facts li { display:flex; align-items:center; gap:6px; } + .facts strong { color:var(--ink-2); font-weight:600; font-variant-numeric:tabular-nums; } + .facts svg { width:14px; height:14px; } .facts svg circle { fill:var(--ok); } .facts svg path { stroke:#fff; } + .err { color:var(--crit); margin:12px 0 0; min-height:1.5em; font-size:.9375rem; } + + .panel, .example { background:var(--surface); border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow); } + .label { font-size:.75rem; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-3); margin:0; } + .q { font-size:1.0625rem; font-weight:500; color:var(--ink); margin:12px 0 16px; padding-left:14px; border-left:3px solid var(--line-2); } + + .example { padding:20px; margin:0; } + .example figcaption { display:flex; gap:8px; align-items:baseline; flex-wrap:wrap; } + .ex-meta { color:var(--ink-3); font-size:.8125rem; } + .ex-verdict { display:flex; gap:8px; align-items:center; font-weight:600; margin:0 0 12px; } + .ex-verdict svg { width:18px; height:18px; flex:none; } .ex-verdict svg circle { fill:var(--ok); } .ex-verdict svg path { stroke:#fff; } + .example[hidden], section[hidden], div[hidden] { display:none; } + + ol.recs { list-style:none; margin:0; padding:0; border:1px solid var(--line); border-radius:8px; overflow:hidden; } + ol.recs li { display:grid; grid-template-columns:28px 1fr auto; align-items:start; gap:12px; padding:12px 14px; border-top:1px solid var(--line); } + ol.recs li:first-child { border-top:0; } + ol.recs .n { font-variant-numeric:tabular-nums; font-weight:600; color:var(--ink-3); text-align:center; line-height:1.5; } + ol.recs .name { font-weight:600; min-width:0; overflow-wrap:anywhere; } + ol.recs li.you { background:var(--accent-soft); } + ol.recs li.you .n, ol.recs li.you .name { color:var(--accent-ink); } + ol.recs.compact li { grid-template-columns:28px 1fr; padding:10px 12px; } + .tag { display:inline-block; margin-left:6px; padding:1px 8px; border-radius:999px; background:var(--accent-deep); color:var(--on-accent); font-size:.75rem; font-weight:600; vertical-align:2px; } + + .cta { margin-top:16px; padding:28px; display:grid; grid-template-columns:1fr auto; gap:24px; align-items:center; } + .cta h2 { font-size:1.375rem; line-height:1.25; margin:0 0 8px; letter-spacing:-.015em; } + .cta p { color:var(--ink-2); margin:0; max-width:58ch; } + .engines { display:flex; align-items:center; gap:14px; margin-top:16px; color:var(--ink-3); font-size:.8125rem; flex-wrap:wrap; } + .engines span { display:inline-flex; align-items:center; gap:6px; color:var(--ink-2); font-weight:500; } + .engines img { width:20px; height:20px; display:block; } + .cta a.primary { display:inline-flex; align-items:center; text-decoration:none; } + .ghost { background:none; border:1px solid var(--line-2); color:var(--ink-2); border-radius:8px; padding:8px 12px; font-size:.875rem; min-height:36px; } + .ghost:hover { color:var(--ink); border-color:var(--ink-3); } + + footer { margin-top:48px; padding-top:20px; border-top:1px solid var(--line); color:var(--ink-3); font-size:.8125rem; } + footer a { color:var(--ink-2); } + + @media (max-width:640px) { + .hero { padding-top:20px; } + .urlform { flex-direction:column; } + .urlform input { flex:none; width:100%; } + .primary { width:100%; } + .cta { grid-template-columns:1fr; padding:20px; } + .cta a.primary { justify-content:center; } + } +`; + +// The three engines GeoSuite's analysis asks, served by the worker at /logos/. +export const ENGINES = ``; diff --git a/web/worker.js b/web/worker.js index cf773de..f0be9d2 100644 --- a/web/worker.js +++ b/web/worker.js @@ -11,14 +11,26 @@ // GET / → the page, locale from Accept-Language (it → Italian) // GET /en /it → the page in that locale // GET /api/crawl?url=... → { site, count, capped, xml, error } -// GET /og.png /favicon.svg → static assets +// GET /og.png → Open Graph share image +// GET /favicon.png /favicon.ico /favicon.svg /apple-touch-icon.png +// → GeoSuite's favicon (PNG; /favicon.svg is the old +// path, kept so cached links still get an icon) +// GET /logos/{chatgpt,gemini,perplexity}.svg → engine logos for the CTA import { renderSitemapXml } from '../src/sitemap.js'; import { renderPage } from './page.js'; import OG_PNG from './og.png'; // bundled as ArrayBuffer via the wrangler "Data" rule +// GeoSuite's official favicon (96px) and touch icon (180px): never redraw or recolor. +import FAVICON_PNG from './favicon.png'; +import TOUCH_ICON_PNG from './apple-touch-icon.png'; +// The AI engines' logos in the closing call to action, copied from +// TryGeoSuite/geo-toolkit/logos (bundled as text via the wrangler "Text" rule). +import LOGO_CHATGPT from './logos/chatgpt.svg'; +import LOGO_GEMINI from './logos/gemini.svg'; +import LOGO_PERPLEXITY from './logos/perplexity.svg'; -// A geo "location pin" mark in the GeoSuite accent — inline SVG, no binary. -const FAVICON = ``; +const ENGINE_LOGOS = { chatgpt: LOGO_CHATGPT, gemini: LOGO_GEMINI, perplexity: LOGO_PERPLEXITY }; +const ICON_PATHS = { '/favicon.png': FAVICON_PNG, '/favicon.ico': FAVICON_PNG, '/favicon.svg': FAVICON_PNG, '/apple-touch-icon.png': TOUCH_ICON_PNG }; // '/it' → 'it', '/en' → 'en', '/' → first Accept-Language tag (it → 'it', else 'en'). function pickLang(request, path) { @@ -130,8 +142,14 @@ export default { headers: { 'content-type': 'image/png', 'cache-control': 'public, max-age=86400' }, }); } - if (path === '/favicon.svg') { - return new Response(FAVICON, { + if (Object.hasOwn(ICON_PATHS, path)) { + return new Response(ICON_PATHS[path], { + headers: { 'content-type': 'image/png', 'cache-control': 'public, max-age=86400' }, + }); + } + const logo = path.match(/^\/logos\/(chatgpt|gemini|perplexity)\.svg$/); + if (logo) { + return new Response(ENGINE_LOGOS[logo[1]], { headers: { 'content-type': 'image/svg+xml; charset=utf-8', 'cache-control': 'public, max-age=86400' }, }); } diff --git a/web/wrangler.toml b/web/wrangler.toml index 3bbae63..7de17b0 100644 --- a/web/wrangler.toml +++ b/web/wrangler.toml @@ -2,10 +2,12 @@ name = "sitemap-builder" main = "worker.js" compatibility_date = "2025-01-01" -# Bundle the OG share image (1200×630 PNG) as an ArrayBuffer the Worker serves -# at /og.png — no external host, CSP-safe. +# Bundle the PNGs (OG share image, favicon, touch icon) as ArrayBuffers the +# Worker serves itself: no external host, CSP-safe. rules = [ - { type = "Data", globs = ["**/*.png"], fallthrough = false } + { type = "Data", globs = ["**/*.png"], fallthrough = false }, + # The AI engines' logos in the call to action, copied from geo-toolkit/logos. + { type = "Text", globs = ["**/*.svg"], fallthrough = false } ] # No nodejs_compat / npm install needed: the Worker reuses only the pure