openvibers/openvibe.wiki Commits

Wiki: the front page's title says what the site is (#48)

OP OpenVibers committed 30 days ago · 0b8dbc2558 · 2 files, +3 −2

The front page's <title> was the bare site name. It now says what the site is ("OpenVibe.Wiki: wiki spaces with history and citations"), so search results and shared links read like a product. The shared layout cuts titles at 60 characters, so this one is short. Other pages keep "<page> · OpenVibe.Wiki".

The full suite passes.

Changes

ddiff --git a/server/render/layout.js b/server/render/layout.js
iindex d00ca9f..aa465cd 100644
---- a/server/render/layout.js
++++ b/server/render/layout.js
@@@ -83,7 +83,8 @@ function renderPage(o) {
site: 'wiki',
siteName: SITE_NAME,
lang: 'en',
-- title: o.title ? `${o.title} · ${SITE_NAME}` : SITE_NAME,
++ // The front page's title says what the site is (search results show it); every other page is "<page> · OpenVibe.Wiki".
++ title: o.title ? `${o.title} · ${SITE_NAME}` : o.path === '/' ? `${SITE_NAME}: wiki spaces with history and citations` : SITE_NAME,
description: o.description || DEFAULT_DESCRIPTION,
summary: o.summary,
canonical: `${config.baseUrl}${o.path || '/'}`,
ddiff --git a/test/layout.test.js b/test/layout.test.js
iindex a12e641..3aba777 100644
---- a/test/layout.test.js
++++ b/test/layout.test.js
@@@ -52,7 +52,7 @@ const robotsOf = (head) => /<meta name="robots" content="([^"]*)">/.exec(head)[1
// The home page: indexable by an explicit robots string, plus the showcase kit's stylesheet.
r = await H.req(h, 'GET', '/');
let { head } = frameOf(r.text, '/');
-- assert.ok(head.includes('<title>OpenVibe.Wiki</title>'), 'the home title is the site name');
++ assert.ok(head.includes('<title>OpenVibe.Wiki: wiki spaces with history and citations</title>'), `the home title says what the site is: ${(/<title>[^<]*<\/title>/.exec(head) || [''])[0]}`);
assert.ok(/<link rel="canonical" href="https?:\/\/[^"\/]+\/">/.test(head), 'the home canonical');
assert.strictEqual(robotsOf(head), 'index, follow');
assert.ok(/<link rel="stylesheet" href="\/shared\/[^"]*showcase[^"]*">/.test(head), 'the extra openvibe-shared stylesheet');