openvibers/openvibe.food Commits

Food: the home page's meta description says what the site does (#41)

OP OpenVibers committed 29 days ago · d322976eba · 2 files, +4 −0

The home page's meta description was the layout's fallback, "OpenVibe.Food — <tagline>" (35-49 characters). A metadata audit of every site flagged it as too short for search results.

- **Home:** it is now a sentence saying what the site does, under 160 characters.
- **/updates:** gets its own description instead of the same fallback.

The home test checks the description is 50-160 characters and is not "Name — tagline".

Changes

ddiff --git a/server/http/pages.js b/server/http/pages.js
iindex ec64346..a7e0d2d 100644
---- a/server/http/pages.js
++++ b/server/http/pages.js
@@@ -103,6 +103,7 @@ ${res_.phone ? html`<p class="small">Phone: <a href="tel:${String(res_.phone).re
});
page(req, res, {
index: true, cache: signedIn(req) ? null : PUBLIC_CACHE,
++ description: 'Find food banks and budget grocers near you, plan meals for a household with the shopping list and its cost, and cook from your cupboard.',
jsonLd: homeJsonLd(config),
styles: [showcase.STYLESHEET],
body: html`${raw(hero)}
@@@ -629,6 +630,7 @@ ${row.recipes.length ? html`<div class="recipe-grid">${row.recipes.map(recipeBlo
r.get('/updates', (req, res) => page(req, res, {
index: true, cache: PUBLIC_CACHE,
title: `What shipped on ${SITE_NAME}`,
++ description: 'Every change deployed to OpenVibe.Food, newest first, from the OpenVibe network\'s shared update log.',
body: raw(frame.updatesBody({ service: 'food', siteName: SITE_NAME }) + `<script src="${ovServe.url('shipped.js')}" defer></script>`),
}));
ddiff --git a/test/discovery.test.js b/test/discovery.test.js
iindex 693bca0..92e19e0 100644
---- a/test/discovery.test.js
++++ b/test/discovery.test.js
@@@ -71,6 +71,8 @@ const PRIVATE = ['/auth/', '/api/'];
await check('home page: WebSite + the site\'s primary type, the same for every crawler', async () => {
const r = await t.get('/');
++ // The home's meta description is a sentence for search results (50-160 characters), not "Name — tagline".
++ { const d = (/<meta name="description" content="([^"]*)"/.exec(r.text) || [])[1] || ''; assert.ok(d.length >= 50 && d.length <= 160 && !d.includes(' — '), `home description: ${d}`); }
assert.strictEqual(r.status, 200);
const blocks = [...r.text.matchAll(/<script type="application\/ld\+json">([\s\S]*?)<\/script>/g)].map((m) => JSON.parse(m[1]));
const types = blocks.map((b) => b['@type']);