openvibers/openvibe.report Commits

Add WebSite + Organization JSON-LD to the home page (#53)

OP OpenVibers committed 13 days ago · ebda02cf50 · 2 files, +10 −0

Changes

ddiff --git a/server/views/index.js b/server/views/index.js
iindex e1b0322..0389168 100644
---- a/server/views/index.js
++++ b/server/views/index.js
@@@ -12,6 +12,7 @@ const shell = require('openvibe-shared/shell');
const ovServe = require('openvibe-shared/serve');
const appIcon = require('openvibe-shared/app-icon');
const kit = require('openvibe-shared/kit');
++const seo = require('openvibe-shared/seo');
// The short home (the owner's rule, 2026-10-30): pick blocks and folds.
const { pickList, pickListRules, foldAround } = require('./short');
// A short name for a chip: the title, cut where it stops saying anything.
@@@ -254,6 +255,7 @@ function home({ stats, rundown, topics } = {}) {
out = foldAround(out, '>Questions</h2>', 'faq', '<h2 id="rp-faq-h">Questions</h2>');
return layout({
title: null, body: out, active: '/', path: '/', agent: true,
++ jsonLd: [seo.jsonLd.website({ name: 'OpenVibe.Report', url: 'https://openvibe.report/', description: "The network's numbers open to everyone, what streamers talked about in The Rundown, and every stream's after-show report." }), seo.jsonLd.organization()],
// The rule that shows the picked topic of the pick list: one per topic, written for this page.
inlineStyles: [`@supports selector(:has(*)){@media (max-width:640px){${pickListRules('topics', trending.length)}}}`],
});
ddiff --git a/test/pages.test.js b/test/pages.test.js
iindex ebe05bf..93b15d4 100644
---- a/test/pages.test.js
++++ b/test/pages.test.js
@@@ -32,6 +32,14 @@ const { boot, check, done, defaults } = require('./helpers/boot');
});
}
++ await check('the home has WebSite and Organization JSON-LD', async () => {
++ const r = await t.get('/');
++ const ld = [...r.text.matchAll(/<script type="application\/ld\+json">([\s\S]*?)<\/script>/g)].map((m) => JSON.parse(m[1])).flatMap((b) => b['@graph'] || [b]);
++ assert.ok(ld.some((x) => x['@type'] === 'WebSite'), 'WebSite');
++ const org = ld.find((x) => x['@type'] === 'Organization');
++ assert.ok(org && Array.isArray(org.sameAs) && org.sameAs.includes('https://github.com/OpenVibers'), 'Organization');
++ });
++
await check('a page names its canonical and mounts the Frame for service report', async () => {
const r = await t.get('/rundown/t/seattle');
assert.ok(r.text.includes('<link rel="canonical" href="https://openvibe.report/rundown/t/seattle">'));