openvibers/openvibe.studio Commits
Home: carry the site entity as JSON-LD (#48)
Changes
@@@ -1,6 +1,7 @@'use strict';const shell = require('openvibe-shared/shell');const serve = require('openvibe-shared/serve');++const seo = require('openvibe-shared/seo');const NAV = [{ label: 'Home', href: '/' },{ label: 'Photo', href: '/photo' },@@@ -9,7 +10,7 @@ const NAV = [function page({ title, body, viewer, config, path = '/' }) {const nav = { service: 'studio', apiBase: config.networkUrl, links: NAV.map((x) => ({ ...x, active: path === x.href })), history: { type: 'page', title }, silentLogin: `${config.baseUrl}/auth/login?silent=1&next={url}`, sessionUrl: '/auth/me', loginUrl: '/auth/login?next={path}', logoutUrl: '/auth/logout?next={path}' };const footer = { service: 'studio', variant: 'full', brandName: 'OpenVibe.Studio' };-- return shell.page({ name: 'OpenVibe.Studio', lang: 'en', title: `${title} · OpenVibe.Studio`, titleSuffix: '', siteName: 'OpenVibe.Studio', description: 'Photo and Light, the creative apps on the OpenVibe network.', canonical: `${config.baseUrl}${path}`, robots: 'index, follow', home: '/', navLinks: NAV, navbar: nav, footer,++ return shell.page({ name: 'OpenVibe.Studio', lang: 'en', title: `${title} · OpenVibe.Studio`, titleSuffix: '', siteName: 'OpenVibe.Studio', description: 'Photo and Light, the creative apps on the OpenVibe network.', canonical: `${config.baseUrl}${path}`, robots: 'index, follow', jsonLd: [seo.jsonLd.website({ name: 'OpenVibe.Studio', url: `${config.baseUrl}/`, description: 'Photo and Light, the creative apps on the OpenVibe network.' })], home: '/', navLinks: NAV, navbar: nav, footer,head: `<link rel="stylesheet" href="${serve.url('kit.css')}"><link rel="stylesheet" href="/css/studio.css"><meta name="referrer" content="strict-origin-when-cross-origin">`,body: `<div id="navbar-mount"></div><main id="main" class="studio-page">${body}</main>` });}@@@ -109,6 +109,8 @@ test('the home names both apps, their limits and their licences', async (t) => {const res = await fetch(s.base);assert.equal(res.status, 200);const html = await res.text();++ assert.match(html, /<script type="application\/ld\+json">[^<]*"@type":"WebSite"/, 'the home carries the site entity for search engines');++ assert.match(html, /"name":"OpenVibe\.Studio"/);assert.match(html, /PhotoCraft/);assert.match(html, /LightCraft/);assert.match(html, /Good to know/);
@@ -1,6 +1,7 @@
@@ -1,6 +1,7 @@
'use strict';
'use strict';
const shell = require('openvibe-shared/shell');
const shell = require('openvibe-shared/shell');
const serve = require('openvibe-shared/serve');
const serve = require('openvibe-shared/serve');
+const seo = require('openvibe-shared/seo');
const NAV = [
const NAV = [
{ label: 'Home', href: '/' },
{ label: 'Home', href: '/' },
{ label: 'Photo', href: '/photo' },
{ label: 'Photo', href: '/photo' },
@@ -9,7 +10,7 @@ const NAV = [
@@ -9,7 +10,7 @@ const NAV = [
function page({ title, body, viewer, config, path = '/' }) {
function page({ title, body, viewer, config, path = '/' }) {
const nav = { service: 'studio', apiBase: config.networkUrl, links: NAV.map((x) => ({ ...x, active: path === x.href })), history: { type: 'page', title }, silentLogin: `${config.baseUrl}/auth/login?silent=1&next={url}`, sessionUrl: '/auth/me', loginUrl: '/auth/login?next={path}', logoutUrl: '/auth/logout?next={path}' };
const nav = { service: 'studio', apiBase: config.networkUrl, links: NAV.map((x) => ({ ...x, active: path === x.href })), history: { type: 'page', title }, silentLogin: `${config.baseUrl}/auth/login?silent=1&next={url}`, sessionUrl: '/auth/me', loginUrl: '/auth/login?next={path}', logoutUrl: '/auth/logout?next={path}' };
const footer = { service: 'studio', variant: 'full', brandName: 'OpenVibe.Studio' };
const footer = { service: 'studio', variant: 'full', brandName: 'OpenVibe.Studio' };
- return shell.page({ name: 'OpenVibe.Studio', lang: 'en', title: `${title} · OpenVibe.Studio`, titleSuffix: '', siteName: 'OpenVibe.Studio', description: 'Photo and Light, the creative apps on the OpenVibe network.', canonical: `${config.baseUrl}${path}`, robots: 'index, follow', home: '/', navLinks: NAV, navbar: nav, footer,
+ return shell.page({ name: 'OpenVibe.Studio', lang: 'en', title: `${title} · OpenVibe.Studio`, titleSuffix: '', siteName: 'OpenVibe.Studio', description: 'Photo and Light, the creative apps on the OpenVibe network.', canonical: `${config.baseUrl}${path}`, robots: 'index, follow', jsonLd: [seo.jsonLd.website({ name: 'OpenVibe.Studio', url: `${config.baseUrl}/`, description: 'Photo and Light, the creative apps on the OpenVibe network.' })], home: '/', navLinks: NAV, navbar: nav, footer,
head: `<link rel="stylesheet" href="${serve.url('kit.css')}"><link rel="stylesheet" href="/css/studio.css"><meta name="referrer" content="strict-origin-when-cross-origin">`,
head: `<link rel="stylesheet" href="${serve.url('kit.css')}"><link rel="stylesheet" href="/css/studio.css"><meta name="referrer" content="strict-origin-when-cross-origin">`,
body: `<div id="navbar-mount"></div><main id="main" class="studio-page">${body}</main>` });
body: `<div id="navbar-mount"></div><main id="main" class="studio-page">${body}</main>` });
}
}
@@ -109,6 +109,8 @@ test('the home names both apps, their limits and their licences', async (t) => {
@@ -109,6 +109,8 @@ test('the home names both apps, their limits and their licences', async (t) => {
const res = await fetch(s.base);
const res = await fetch(s.base);
assert.equal(res.status, 200);
assert.equal(res.status, 200);
const html = await res.text();
const html = await res.text();
+ assert.match(html, /<script type="application\/ld\+json">[^<]*"@type":"WebSite"/, 'the home carries the site entity for search engines');
+ assert.match(html, /"name":"OpenVibe\.Studio"/);
assert.match(html, /PhotoCraft/);
assert.match(html, /PhotoCraft/);
assert.match(html, /LightCraft/);
assert.match(html, /LightCraft/);
assert.match(html, /Good to know/);
assert.match(html, /Good to know/);