openvibers/openvibe.food Commits

Food near you is in search: /near says index without a search (it was noindex by default while the sitemap listed it); searches stay noindex (#67)

OP OpenVibers committed 24 days ago · e7263acccb · 2 files, +4 −0

Changes

ddiff --git a/server/http/pages.js b/server/http/pages.js
iindex 6348efa..a667f4a 100644
---- a/server/http/pages.js
++++ b/server/http/pages.js
@@@ -156,8 +156,10 @@ ${raw(showcase.cta({
}
}
const title = out && out.location.name ? `Food near ${out.location.name.split(',').slice(0, 2).join(',')}` : 'Food near you';
++ // The page itself is in search (the sitemap lists it; it was noindex by default); a search's results are not.
page(req, res, {
title, description: 'Food banks, pantries and budget grocery stores near a place, from OpenStreetMap.',
++ index: !wantsSearch(req), cache: !wantsSearch(req) && !signedIn(req) ? PUBLIC_CACHE : null,
crumbs: [{ label: 'Food near you' }], styles: [showcase.STYLESHEET],
body: html`<h1>Food near you</h1>
<p class="lede">Food banks, soup kitchens, community fridges, free pantry boxes and budget grocery stores, from OpenStreetMap.</p>
ddiff --git a/test/foods.test.js b/test/foods.test.js
iindex 060bf1a..b223dd2 100644
---- a/test/foods.test.js
++++ b/test/foods.test.js
@@@ -61,6 +61,8 @@ const foods = require('../server/food/foods');
assert.match(r.text, /<link rel="canonical" href="[^"]*\/plan">/);
const map = await t.get('/sitemap.xml');
assert.match(map.text, /<loc>[^<]*\/plan<\/loc>/, 'and the sitemap lists it');
++ // So is "food near you" itself; a search's results are not.
++ assert.match((await t.get('/near')).text, /<meta name="robots" content="index, follow">/);
});
await check('the /foods page and one food page render server-side, per serving and per 100 g', async () => {