← back to Costa Rica
yolo tick 7: per-vertical landing pages — /verticals overview (12 verticals grouped by tourism/rentals/service) + /v/:slug detail (top 24 regions, by-province, 24 sample listings) + /api/verticals + /api/verticals/:slug + sitemap dynamic vertical entries + Verticals nav link
6f4c5ce08dab3bc095b592c2f503826be4c815bb · 2026-05-08 12:47:11 -0700 · Steve
Files touched
M public/index.htmlM public/province.htmlM public/provinces.htmlM public/search.htmlM public/stats.htmlA public/vertical.htmlA public/verticals.htmlM server.js
Diff
commit 6f4c5ce08dab3bc095b592c2f503826be4c815bb
Author: Steve <steve@designerwallcoverings.com>
Date: Fri May 8 12:47:11 2026 -0700
yolo tick 7: per-vertical landing pages — /verticals overview (12 verticals grouped by tourism/rentals/service) + /v/:slug detail (top 24 regions, by-province, 24 sample listings) + /api/verticals + /api/verticals/:slug + sitemap dynamic vertical entries + Verticals nav link
---
public/index.html | 1 +
public/province.html | 1 +
public/provinces.html | 1 +
public/search.html | 1 +
public/stats.html | 2 +-
public/vertical.html | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++
public/verticals.html | 81 ++++++++++++++++++++++++++++
server.js | 77 +++++++++++++++++++++++++++
8 files changed, 305 insertions(+), 1 deletion(-)
diff --git a/public/index.html b/public/index.html
index 91dc993..58d05ef 100644
--- a/public/index.html
+++ b/public/index.html
@@ -79,6 +79,7 @@
<a href="#" data-cat="service">Local services</a>
<a href="/search">Search</a>
<a href="/provinces">Provinces</a>
+ <a href="/verticals">Verticals</a>
<a href="/stats">Stats</a>
</nav>
<div class="ml-auto" style="display:flex;gap:8px;align-items:center">
diff --git a/public/province.html b/public/province.html
index c2f5c1f..8988b08 100644
--- a/public/province.html
+++ b/public/province.html
@@ -67,6 +67,7 @@
<a href="/">Browse</a>
<a href="/search">Search</a>
<a href="/provinces" class="active">Provinces</a>
+ <a href="/verticals">Verticals</a>
<a href="/stats">Stats</a>
</nav>
<div class="ml-auto"><button class="icon-btn" id="themeBtn" aria-label="Theme">◐</button></div>
diff --git a/public/provinces.html b/public/provinces.html
index fa5e211..e2cfaae 100644
--- a/public/provinces.html
+++ b/public/provinces.html
@@ -49,6 +49,7 @@
<a href="/">Browse</a>
<a href="/search">Search</a>
<a href="/provinces" class="active">Provinces</a>
+ <a href="/verticals">Verticals</a>
<a href="/stats">Stats</a>
</nav>
<div class="ml-auto"><button class="icon-btn" id="themeBtn" aria-label="Theme">◐</button></div>
diff --git a/public/search.html b/public/search.html
index 5c0b6ab..7c232ff 100644
--- a/public/search.html
+++ b/public/search.html
@@ -60,6 +60,7 @@
<nav class="nav-links">
<a href="/">Browse</a>
<a href="/provinces">Provinces</a>
+ <a href="/verticals">Verticals</a>
<a href="/search" class="active">Search</a>
<a href="/stats">Stats</a>
</nav>
diff --git a/public/stats.html b/public/stats.html
index 57b908b..bd6cf51 100644
--- a/public/stats.html
+++ b/public/stats.html
@@ -44,7 +44,7 @@
<header class="nav"><div class="nav-in">
<a class="brand" href="/"><span class="pin">●</span> Costa Rica Directory</a>
<nav class="nav-links">
- <a href="/">Browse</a><a href="/search">Search</a><a href="/provinces">Provinces</a><a href="/stats" class="active">Stats</a>
+ <a href="/">Browse</a><a href="/search">Search</a><a href="/provinces">Provinces</a><a href="/verticals">Verticals</a><a href="/stats" class="active">Stats</a>
</nav>
<div class="ml-auto"><button class="icon-btn" id="themeBtn" aria-label="Theme">◐</button></div>
</div></header>
diff --git a/public/vertical.html b/public/vertical.html
new file mode 100644
index 0000000..def54ec
--- /dev/null
+++ b/public/vertical.html
@@ -0,0 +1,142 @@
+<!doctype html>
+<html lang="en" data-theme="light">
+<head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title>Loading… — Costa Rica Directory</title>
+ <script>(function(){try{var t=localStorage.getItem('cr-theme');if(t)document.documentElement.setAttribute('data-theme',t);}catch(e){}})();</script>
+ <style>
+ :root{--bg:#fafaf7;--fg:#0e1015;--muted:#5a6270;--line:#e3e0d6;--card:#fff;--card-line:#ebe7da;--accent:#0a7a3a;--accent-2:#c2a85a}
+ [data-theme="dark"]{--bg:#0e1015;--fg:#f3f1ea;--muted:#9aa3b2;--line:#23262d;--card:#15181f;--card-line:#262932;--accent:#3ec07a;--accent-2:#d8c074}
+ *{box-sizing:border-box}
+ body{margin:0;background:var(--bg);color:var(--fg);font-family:-apple-system,BlinkMacSystemFont,'Inter','Segoe UI',Roboto,sans-serif;line-height:1.55}
+ a{color:inherit;text-decoration:none} a:hover{color:var(--accent)}
+ .nav{position:sticky;top:0;z-index:30;background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:saturate(160%) blur(10px);border-bottom:1px solid var(--line)}
+ .nav-in{max-width:1320px;margin:0 auto;padding:14px 22px;display:flex;align-items:center;gap:18px;flex-wrap:wrap}
+ .brand{font-weight:700;font-size:18px} .brand .pin{color:var(--accent)}
+ .nav-links{display:flex;gap:14px;flex-wrap:wrap;color:var(--muted);font-size:14px}
+ .nav-links a.active{color:var(--fg);font-weight:600}
+ .ml-auto{margin-left:auto} .icon-btn{appearance:none;background:transparent;color:inherit;border:1px solid var(--line);border-radius:999px;width:36px;height:36px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer}
+
+ .crumbs{max-width:1320px;margin:0 auto;padding:14px 22px 0;color:var(--muted);font-size:13px}
+ .crumbs a{color:var(--accent);font-weight:600}
+
+ main{max-width:1320px;margin:0 auto;padding:18px 22px 40px}
+ .head h1{margin:0;font-size:clamp(34px,5vw,52px);letter-spacing:-.02em;text-transform:capitalize}
+ .head .meta{color:var(--muted);font-size:14px;margin-top:6px}
+ .strip{display:flex;flex-wrap:wrap;gap:10px;margin:14px 0 22px}
+ .pill{font-size:12px;color:var(--muted);background:var(--card);border:1px solid var(--card-line);border-radius:999px;padding:6px 12px}
+ .pill b{color:var(--fg);font-weight:700}
+
+ .cols{display:grid;grid-template-columns:1.4fr 1fr;gap:22px}
+ @media (max-width:980px){.cols{grid-template-columns:1fr}}
+ .panel{background:var(--card);border:1px solid var(--card-line);border-radius:14px;padding:18px}
+ .panel h2{margin:0 0 12px;font-size:18px;letter-spacing:-.01em}
+
+ .pgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:10px}
+ .pcard{background:var(--bg);border:1px solid var(--line);border-radius:12px;overflow:hidden;display:flex;flex-direction:column;transition:transform .15s ease}
+ .pcard:hover{transform:translateY(-2px)}
+ .pcard .pi{aspect-ratio:1.4/1;background:linear-gradient(135deg, color-mix(in srgb, var(--accent) 25%, var(--card)), color-mix(in srgb, var(--accent-2) 22%, var(--card)));overflow:hidden}
+ .pcard .pi img{width:100%;height:100%;object-fit:cover;display:block}
+ .pcard .pb{padding:10px 12px;font-size:13px}
+ .pcard .pn{font-weight:700;line-height:1.2}
+ .pcard .pa{color:var(--muted);font-size:11px;margin-top:2px}
+
+ .rgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:10px}
+ .rcard{background:var(--bg);border:1px solid var(--line);border-radius:12px;overflow:hidden;display:flex}
+ .rcard .ri{width:72px;flex:0 0 72px;background:linear-gradient(135deg, color-mix(in srgb, var(--accent) 25%, var(--card)), color-mix(in srgb, var(--accent-2) 22%, var(--card)));overflow:hidden}
+ .rcard .ri img{width:100%;height:100%;object-fit:cover;display:block}
+ .rcard .rb{padding:8px 12px;display:flex;flex-direction:column;justify-content:center}
+ .rcard .rn{font-weight:600;line-height:1.2;font-size:14px}
+ .rcard .rm{color:var(--muted);font-size:11px;margin-top:2px}
+
+ .pv ul{margin:0;padding:0;list-style:none}
+ .pv li{display:flex;justify-content:space-between;padding:8px 4px;border-bottom:1px dashed var(--line);font-size:14px}
+ .pv li:last-child{border-bottom:0}
+ .pv .num{font-variant-numeric:tabular-nums;color:var(--muted)}
+ .skel{height:200px;background:linear-gradient(110deg,var(--card) 8%,var(--bg) 18%,var(--card) 33%);background-size:200% 100%;animation:s 1.6s linear infinite;border-radius:14px}
+ @keyframes s{0%{background-position:200% 0}100%{background-position:-200% 0}}
+ </style>
+</head>
+<body>
+ <header class="nav"><div class="nav-in">
+ <a class="brand" href="/"><span class="pin">●</span> Costa Rica Directory</a>
+ <nav class="nav-links">
+ <a href="/">Browse</a>
+ <a href="/search">Search</a>
+ <a href="/provinces">Provinces</a>
+ <a href="/verticals" class="active">Verticals</a>
+ <a href="/stats">Stats</a>
+ </nav>
+ <div class="ml-auto"><button class="icon-btn" id="themeBtn" aria-label="Theme">◐</button></div>
+ </div></header>
+
+ <div class="crumbs"><a href="/verticals">Verticals</a> › <span id="bcurr">…</span></div>
+
+ <main id="main">
+ <div class="head"><h1 id="title">Loading…</h1></div>
+ <div class="skel"></div>
+ </main>
+
+ <script>
+ const themeBtn=document.getElementById('themeBtn');
+ themeBtn.addEventListener('click',()=>{const cur=document.documentElement.getAttribute('data-theme')||'light';const nx=cur==='light'?'dark':'light';document.documentElement.setAttribute('data-theme',nx);try{localStorage.setItem('cr-theme',nx);}catch{}});
+
+ const slug=location.pathname.split('/').filter(Boolean)[1];
+ const niceVert=v=>v.replace(/^(service|tourism|rentals)_/,'').replace(/_/g,' ');
+
+ fetch('/api/verticals/'+encodeURIComponent(slug)).then(r=>r.json()).then(v=>{
+ if(v.error){document.getElementById('main').innerHTML=`<p style="color:var(--muted)">${v.error}</p>`;return;}
+ const label=niceVert(v.vertical);
+ document.title=`${label.charAt(0).toUpperCase()+label.slice(1)} in Costa Rica — Directory`;
+ document.getElementById('bcurr').textContent=label;
+
+ const samplesHtml=(v.samples||[]).map(s=>{
+ const img=s.image_url||s.region_image_url||'';
+ return `<a class="pcard" href="/p/${s.slug}">
+ <div class="pi">${img?`<img loading="lazy" alt="${s.name}" src="${img}" />`:''}</div>
+ <div class="pb"><div class="pn">${s.name}</div><div class="pa">${s.region_name||''}${s.address?' · '+s.address.slice(0,32):''}</div></div>
+ </a>`;
+ }).join('');
+
+ const regHtml=(v.by_region||[]).map(r=>`
+ <a class="rcard" href="/r/${r.slug}">
+ <div class="ri">${r.image_url?`<img loading="lazy" alt="${r.name}" src="${r.image_url}" />`:''}</div>
+ <div class="rb"><div class="rn">${r.name}</div><div class="rm">${r.province} · ${(r.n||0).toLocaleString()}</div></div>
+ </a>`).join('');
+
+ const provSlug={'San José':'san-jose','Alajuela':'alajuela','Heredia':'heredia','Cartago':'cartago','Guanacaste':'guanacaste','Puntarenas':'puntarenas','Limón':'limon'};
+ const provHtml=(v.by_province||[]).map(p=>`
+ <li><a href="/pr/${provSlug[p.name]||''}">${p.name}</a><span class="num">${p.n.toLocaleString()}</span></li>`).join('');
+
+ document.getElementById('main').innerHTML=`
+ <div class="head">
+ <h1 id="title">${label.charAt(0).toUpperCase()+label.slice(1)}</h1>
+ <div class="meta">${v.category} · ${v.total.toLocaleString()} listings · ${v.by_region.length} regions covered</div>
+ </div>
+ <div class="strip">
+ <span class="pill"><b>${v.total.toLocaleString()}</b> listings</span>
+ <span class="pill"><b>${v.by_region.length}</b> regions</span>
+ <span class="pill"><b>${v.by_province.length}</b> provinces</span>
+ <a class="pill" href="/?q=${encodeURIComponent(label)}" style="color:var(--accent);font-weight:600">Browse all →</a>
+ </div>
+ <div class="cols">
+ <section class="panel">
+ <h2>Featured ${label}</h2>
+ <div class="pgrid">${samplesHtml||'<span style="color:var(--muted);font-size:13px">no listings yet</span>'}</div>
+ </section>
+ <aside style="display:flex;flex-direction:column;gap:18px">
+ <section class="panel pv">
+ <h2>By province</h2>
+ <ul>${provHtml||'<li style="color:var(--muted)">none</li>'}</ul>
+ </section>
+ <section class="panel">
+ <h2>Top regions</h2>
+ <div class="rgrid">${regHtml||'<span style="color:var(--muted);font-size:13px">none</span>'}</div>
+ </section>
+ </aside>
+ </div>`;
+ }).catch(e=>{document.getElementById('main').innerHTML=`<p style="color:var(--muted)">Could not load: ${e.message}</p>`;});
+ </script>
+</body>
+</html>
diff --git a/public/verticals.html b/public/verticals.html
new file mode 100644
index 0000000..b0f9e82
--- /dev/null
+++ b/public/verticals.html
@@ -0,0 +1,81 @@
+<!doctype html>
+<html lang="en" data-theme="light">
+<head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title>Verticals — Costa Rica Directory</title>
+ <script>(function(){try{var t=localStorage.getItem('cr-theme');if(t)document.documentElement.setAttribute('data-theme',t);}catch(e){}})();</script>
+ <style>
+ :root{--bg:#fafaf7;--fg:#0e1015;--muted:#5a6270;--line:#e3e0d6;--card:#fff;--card-line:#ebe7da;--accent:#0a7a3a;--accent-2:#c2a85a}
+ [data-theme="dark"]{--bg:#0e1015;--fg:#f3f1ea;--muted:#9aa3b2;--line:#23262d;--card:#15181f;--card-line:#262932;--accent:#3ec07a;--accent-2:#d8c074}
+ *{box-sizing:border-box}
+ body{margin:0;background:var(--bg);color:var(--fg);font-family:-apple-system,BlinkMacSystemFont,'Inter','Segoe UI',Roboto,sans-serif;line-height:1.55}
+ a{color:inherit;text-decoration:none} a:hover{color:var(--accent)}
+ .nav{position:sticky;top:0;z-index:30;background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:saturate(160%) blur(10px);border-bottom:1px solid var(--line)}
+ .nav-in{max-width:1320px;margin:0 auto;padding:14px 22px;display:flex;align-items:center;gap:18px;flex-wrap:wrap}
+ .brand{font-weight:700;font-size:18px} .brand .pin{color:var(--accent)}
+ .nav-links{display:flex;gap:14px;flex-wrap:wrap;color:var(--muted);font-size:14px}
+ .nav-links a.active{color:var(--fg);font-weight:600}
+ .ml-auto{margin-left:auto} .icon-btn{appearance:none;background:transparent;color:inherit;border:1px solid var(--line);border-radius:999px;width:36px;height:36px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer}
+
+ main{max-width:1320px;margin:0 auto;padding:32px 22px 48px}
+ h1{font-size:clamp(32px,4.5vw,48px);letter-spacing:-.02em;margin:0 0 6px}
+ .lead{color:var(--muted);max-width:720px;margin:0 0 22px}
+ .group{margin:24px 0 12px;display:flex;align-items:end;gap:10px}
+ .group h2{margin:0;font-size:18px;text-transform:capitalize;letter-spacing:-.01em}
+ .group .ct{color:var(--muted);font-size:13px}
+ .grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:14px}
+ .vc{background:var(--card);border:1px solid var(--card-line);border-radius:14px;overflow:hidden;display:flex;flex-direction:column;transition:transform .15s ease,box-shadow .15s ease}
+ .vc:hover{transform:translateY(-2px);box-shadow:0 10px 22px rgba(0,0,0,.06)}
+ .vc .img{aspect-ratio:1.6/1;background:linear-gradient(135deg, color-mix(in srgb, var(--accent) 25%, var(--card)), color-mix(in srgb, var(--accent-2) 22%, var(--card)));overflow:hidden}
+ .vc .img img{width:100%;height:100%;object-fit:cover;display:block}
+ .vc .body{padding:12px 14px}
+ .vc .nm{font-weight:700;text-transform:capitalize;letter-spacing:-.01em}
+ .vc .ct{color:var(--muted);font-size:13px;margin-top:2px}
+ .skel{height:200px;background:linear-gradient(110deg,var(--card) 8%,var(--bg) 18%,var(--card) 33%);background-size:200% 100%;animation:s 1.6s linear infinite;border-radius:14px}
+ @keyframes s{0%{background-position:200% 0}100%{background-position:-200% 0}}
+ </style>
+</head>
+<body>
+ <header class="nav"><div class="nav-in">
+ <a class="brand" href="/"><span class="pin">●</span> Costa Rica Directory</a>
+ <nav class="nav-links">
+ <a href="/">Browse</a>
+ <a href="/search">Search</a>
+ <a href="/provinces">Provinces</a>
+ <a href="/verticals" class="active">Verticals</a>
+ <a href="/stats">Stats</a>
+ </nav>
+ <div class="ml-auto"><button class="icon-btn" id="themeBtn" aria-label="Theme">◐</button></div>
+ </div></header>
+
+ <main>
+ <h1>Browse by vertical</h1>
+ <p class="lead">12 verticals across tourism, rentals, and local services. Pick one to see the top regions, sample listings, and a province-by-province breakdown.</p>
+ <div id="out"><div class="grid"><div class="skel"></div><div class="skel"></div><div class="skel"></div><div class="skel"></div></div></div>
+ </main>
+
+ <script>
+ const themeBtn=document.getElementById('themeBtn');
+ themeBtn.addEventListener('click',()=>{const cur=document.documentElement.getAttribute('data-theme')||'light';const nx=cur==='light'?'dark':'light';document.documentElement.setAttribute('data-theme',nx);try{localStorage.setItem('cr-theme',nx);}catch{}});
+
+ const CAT_ORDER=['tourism','rentals','service'];
+ const CAT_LABEL={tourism:'Tourism',rentals:'Rentals',service:'Local services'};
+ const niceVert=v=>v.replace(/^(service|tourism|rentals)_/,'').replace(/_/g,' ');
+ fetch('/api/verticals').then(r=>r.json()).then(d=>{
+ const by={};for(const v of d.verticals){(by[v.category]=by[v.category]||[]).push(v);}
+ const out=document.getElementById('out');
+ out.innerHTML=CAT_ORDER.filter(c=>by[c]&&by[c].length).map(cat=>{
+ const items=by[cat];
+ const total=items.reduce((s,v)=>s+v.n,0);
+ return `<div class="group"><h2>${CAT_LABEL[cat]}</h2><span class="ct">${items.length} verticals · ${total.toLocaleString()} listings</span></div>
+ <div class="grid">${items.map(v=>`
+ <a class="vc" href="/v/${v.slug}">
+ <div class="img">${v.image_url?`<img loading="lazy" alt="${niceVert(v.vertical)}" src="${v.image_url}" />`:''}</div>
+ <div class="body"><div class="nm">${niceVert(v.vertical)}</div><div class="ct">${v.n.toLocaleString()} listings</div></div>
+ </a>`).join('')}</div>`;
+ }).join('');
+ }).catch(e=>{document.getElementById('out').innerHTML=`<p style="color:var(--muted)">Could not load: ${e.message}</p>`;});
+ </script>
+</body>
+</html>
diff --git a/server.js b/server.js
index f5d6765..0c08294 100644
--- a/server.js
+++ b/server.js
@@ -144,6 +144,76 @@ app.get('/api/provinces/:slug', async (req, res) => {
} catch (e) { res.status(500).json({ error: e.message }); }
});
+// Vertical = e.g. service_retail, tourism_hotel, rentals_realestate.
+// Slug uses hyphens: service_retail <-> service-retail.
+const vSlug = v => String(v || '').replaceAll('_', '-').toLowerCase();
+const vUnSlug = s => String(s || '').replaceAll('-', '_').toLowerCase();
+
+app.get('/api/verticals', async (_req, res) => {
+ try {
+ const { rows } = await pool.query(`
+ WITH counts AS (
+ SELECT vertical, category, COUNT(*)::int AS n
+ FROM places WHERE status='active' GROUP BY vertical, category
+ ),
+ samples AS (
+ SELECT DISTINCT ON (p.vertical) p.vertical, p.image_url, r.image_url AS region_image_url
+ FROM places p LEFT JOIN regions r ON r.id = p.region_id
+ WHERE p.status='active'
+ ORDER BY p.vertical, (p.image_url IS NOT NULL) DESC, p.id DESC
+ )
+ SELECT c.vertical, c.category, c.n,
+ COALESCE(s.image_url, s.region_image_url) AS image_url
+ FROM counts c LEFT JOIN samples s ON s.vertical = c.vertical
+ ORDER BY c.n DESC, c.vertical ASC`);
+ res.json({ verticals: rows.map(r => ({ ...r, slug: vSlug(r.vertical) })) });
+ } catch (e) { res.status(500).json({ error: e.message }); }
+});
+
+app.get('/api/verticals/:slug', async (req, res) => {
+ try {
+ const vertical = vUnSlug(req.params.slug);
+ const [{ rows: meta }, { rows: byRegion }, { rows: byProv }, { rows: samples }] = await Promise.all([
+ pool.query(
+ `SELECT vertical, category, COUNT(*)::int AS total
+ FROM places WHERE vertical=$1 AND status='active'
+ GROUP BY vertical, category`, [vertical]
+ ),
+ pool.query(
+ `SELECT r.slug, r.name, r.province, r.image_url, COUNT(p.id)::int AS n
+ FROM places p JOIN regions r ON r.id = p.region_id
+ WHERE p.vertical=$1 AND p.status='active'
+ GROUP BY r.id
+ ORDER BY n DESC, r.name ASC LIMIT 24`, [vertical]
+ ),
+ pool.query(
+ `SELECT r.province AS name, COUNT(p.id)::int AS n
+ FROM places p JOIN regions r ON r.id = p.region_id
+ WHERE p.vertical=$1 AND p.status='active'
+ GROUP BY r.province ORDER BY n DESC`, [vertical]
+ ),
+ pool.query(
+ `SELECT p.slug, p.name, p.image_url, p.address, p.website,
+ r.slug AS region_slug, r.name AS region_name, r.province,
+ r.image_url AS region_image_url
+ FROM places p JOIN regions r ON r.id = p.region_id
+ WHERE p.vertical=$1 AND p.status='active'
+ ORDER BY (p.image_url IS NOT NULL) DESC, p.id DESC LIMIT 24`, [vertical]
+ ),
+ ]);
+ if (!meta.length) return res.status(404).json({ error: 'unknown vertical' });
+ res.json({
+ slug: req.params.slug,
+ vertical,
+ category: meta[0].category,
+ total: meta[0].total,
+ by_region: byRegion,
+ by_province: byProv,
+ samples,
+ });
+ } catch (e) { res.status(500).json({ error: e.message }); }
+});
+
// Cross-entity search: places + regions + provinces, grouped & ranked
app.get('/api/search', async (req, res) => {
try {
@@ -410,6 +480,9 @@ app.get('/sitemap.xml', async (_req, res, next) => {
const { rows: regions } = await pool.query(
`SELECT slug, name FROM regions WHERE region_type IN ('city','town','canton') ORDER BY name`
);
+ const { rows: verticals } = await pool.query(
+ `SELECT DISTINCT vertical FROM places WHERE status='active' ORDER BY vertical`
+ );
const { rows: places } = await pool.query(
`SELECT slug, updated_at, image_url FROM places WHERE status='active' ORDER BY id DESC LIMIT 48000`
);
@@ -417,12 +490,14 @@ app.get('/sitemap.xml', async (_req, res, next) => {
const staticPages = [
{ loc: '/', changefreq: 'daily', priority: '1.0' },
{ loc: '/provinces', changefreq: 'weekly', priority: '0.8' },
+ { loc: '/verticals', changefreq: 'weekly', priority: '0.8' },
{ loc: '/search', changefreq: 'weekly', priority: '0.6' },
{ loc: '/stats', changefreq: 'weekly', priority: '0.5' },
{ loc: '/?category=tourism', changefreq: 'daily', priority: '0.8' },
{ loc: '/?category=rentals', changefreq: 'daily', priority: '0.8' },
{ loc: '/?category=service', changefreq: 'daily', priority: '0.8' },
...Object.keys(PROVINCE_SLUGS).map(s => ({ loc: `/pr/${s}`, changefreq: 'weekly', priority: '0.85' })),
+ ...verticals.map(v => ({ loc: `/v/${vSlug(v.vertical)}`, changefreq: 'weekly', priority: '0.7' })),
];
const regionPages = regions.map(r => ({ loc: `/r/${r.slug}`, changefreq: 'weekly', priority: '0.7' }));
@@ -542,6 +617,8 @@ app.get('/p/:slug', async (req, res) => {
app.get('/stats', (_req, res) => res.sendFile(path.join(__dirname, 'public', 'stats.html')));
app.get('/provinces', (_req, res) => res.sendFile(path.join(__dirname, 'public', 'provinces.html')));
app.get('/search', (_req, res) => res.sendFile(path.join(__dirname, 'public', 'search.html')));
+app.get('/verticals', (_req, res) => res.sendFile(path.join(__dirname, 'public', 'verticals.html')));
+app.get('/v/:slug', (_req, res) => res.sendFile(path.join(__dirname, 'public', 'vertical.html')));
app.get('/pr/:slug', async (req, res) => {
if (!PROVINCE_SLUGS[req.params.slug]) return res.status(404).sendFile(path.join(__dirname, 'public', '404.html'));
res.sendFile(path.join(__dirname, 'public', 'province.html'));
← 635d444 yolo tick 6: /search global cross-entity search (places + re
·
back to Costa Rica
·
yolo tick 8: /about page (data sources, attribution, contact 57f58f5 →