openvibers/openvibe.tips Commits
Home says what the site is in structured data (WebSite + WebPage JSON-LD, as the other OpenVibe homes do) (#70)
Changes
@@@ -27,6 +27,7 @@ const cache = require('openvibe-shared/cache-policy');const frame = require('openvibe-shared/frame');const legal = require('openvibe-shared/legal');const seo = require('openvibe-shared/seo');++const HOME_DESCRIPTION = 'Support the creators you watch on OpenVibe: tips, goals, paid messages, text-to-speech and media requests, with stream overlays for creators.';const express = require('express');const { sql } = require('openvibe-sdk/db');const { TipsError } = require('../util');@@@ -81,7 +82,12 @@ function createWebRoutes({ domain, config, layout, userAuth }) {// ── Home, robots, sitemap ────────────────────────────────r.get('/', withViewer, async (req, res) => {const creators = await db.many(sql`SELECT handle, display_name, avatar_url FROM creator_tip_profiles WHERE page_enabled ORDER BY updated_at DESC LIMIT 24`);-- html(res, pageFor(req, { active: 'home', canonicalPath: '/', styles: [require('openvibe-shared/showcase').STYLESHEET], body: pages.home({ creators }) }));++ // What the site is, for search engines (WebSite + WebPage, as the other OpenVibe homes say it).++ const jsonLd = [++ seo.jsonLd.website({ name: 'OpenVibe.Tips', url: config.baseUrl, description: HOME_DESCRIPTION }),++ seo.jsonLd.webPage({ name: 'OpenVibe.Tips', url: `${config.baseUrl}/`, description: HOME_DESCRIPTION, siteUrl: config.baseUrl }),++ ];++ html(res, pageFor(req, { active: 'home', canonicalPath: '/', styles: [require('openvibe-shared/showcase').STYLESHEET], body: pages.home({ creators }), jsonLd }));});// What shipped on OpenVibe.Tips: the shared update log every OpenVibe site has.r.get('/updates', withViewer, (req, res) => html(res, pageFor(req, { canonicalPath: '/updates', title: 'What shipped on OpenVibe.Tips', body: frame.updatesBody({ service: 'tips', siteName: 'OpenVibe.Tips' }) + `<script src="${ovServe.url('shipped.js')}" defer></script>` })));@@@ -29,6 +29,7 @@ const { boot, check, done } = require('./helpers/app');assert.match(r.text, /\/shared\/navbar\.js\?v=[0-9a-f]{12}/);assert.match(r.text, /<meta name="ov-release"/);assert.match(r.text, /id="ov-footer"|class="ovf/);++ assert.match(r.text, /<script type="application\/ld\+json">[^<]*"@type":"WebSite"[^<]*"name":"OpenVibe.Tips"/, 'the home says what the site is (JSON-LD)');assert.match(r.text, /href="\/alex"/);assert.ok(!r.text.includes('href="/bob"'), 'switched-off pages are not listed');// The home opens with the showcase kit (openvibe-shared/showcase): one h1 (the hero), the kit's sheet, the
@@ -27,6 +27,7 @@ const cache = require('openvibe-shared/cache-policy');
@@ -27,6 +27,7 @@ const cache = require('openvibe-shared/cache-policy');
const frame = require('openvibe-shared/frame');
const frame = require('openvibe-shared/frame');
const legal = require('openvibe-shared/legal');
const legal = require('openvibe-shared/legal');
const seo = require('openvibe-shared/seo');
const seo = require('openvibe-shared/seo');
+const HOME_DESCRIPTION = 'Support the creators you watch on OpenVibe: tips, goals, paid messages, text-to-speech and media requests, with stream overlays for creators.';
const express = require('express');
const express = require('express');
const { sql } = require('openvibe-sdk/db');
const { sql } = require('openvibe-sdk/db');
const { TipsError } = require('../util');
const { TipsError } = require('../util');
@@ -81,7 +82,12 @@ function createWebRoutes({ domain, config, layout, userAuth }) {
@@ -81,7 +82,12 @@ function createWebRoutes({ domain, config, layout, userAuth }) {
// ── Home, robots, sitemap ────────────────────────────────
// ── Home, robots, sitemap ────────────────────────────────
r.get('/', withViewer, async (req, res) => {
r.get('/', withViewer, async (req, res) => {
const creators = await db.many(sql`SELECT handle, display_name, avatar_url FROM creator_tip_profiles WHERE page_enabled ORDER BY updated_at DESC LIMIT 24`);
const creators = await db.many(sql`SELECT handle, display_name, avatar_url FROM creator_tip_profiles WHERE page_enabled ORDER BY updated_at DESC LIMIT 24`);
- html(res, pageFor(req, { active: 'home', canonicalPath: '/', styles: [require('openvibe-shared/showcase').STYLESHEET], body: pages.home({ creators }) }));
+ // What the site is, for search engines (WebSite + WebPage, as the other OpenVibe homes say it).
+ const jsonLd = [
+ seo.jsonLd.website({ name: 'OpenVibe.Tips', url: config.baseUrl, description: HOME_DESCRIPTION }),
+ seo.jsonLd.webPage({ name: 'OpenVibe.Tips', url: `${config.baseUrl}/`, description: HOME_DESCRIPTION, siteUrl: config.baseUrl }),
+ ];
+ html(res, pageFor(req, { active: 'home', canonicalPath: '/', styles: [require('openvibe-shared/showcase').STYLESHEET], body: pages.home({ creators }), jsonLd }));
});
});
// What shipped on OpenVibe.Tips: the shared update log every OpenVibe site has.
// What shipped on OpenVibe.Tips: the shared update log every OpenVibe site has.
r.get('/updates', withViewer, (req, res) => html(res, pageFor(req, { canonicalPath: '/updates', title: 'What shipped on OpenVibe.Tips', body: frame.updatesBody({ service: 'tips', siteName: 'OpenVibe.Tips' }) + `<script src="${ovServe.url('shipped.js')}" defer></script>` })));
r.get('/updates', withViewer, (req, res) => html(res, pageFor(req, { canonicalPath: '/updates', title: 'What shipped on OpenVibe.Tips', body: frame.updatesBody({ service: 'tips', siteName: 'OpenVibe.Tips' }) + `<script src="${ovServe.url('shipped.js')}" defer></script>` })));
@@ -29,6 +29,7 @@ const { boot, check, done } = require('./helpers/app');
@@ -29,6 +29,7 @@ const { boot, check, done } = require('./helpers/app');
assert.match(r.text, /\/shared\/navbar\.js\?v=[0-9a-f]{12}/);
assert.match(r.text, /\/shared\/navbar\.js\?v=[0-9a-f]{12}/);
assert.match(r.text, /<meta name="ov-release"/);
assert.match(r.text, /<meta name="ov-release"/);
assert.match(r.text, /id="ov-footer"|class="ovf/);
assert.match(r.text, /id="ov-footer"|class="ovf/);
+ assert.match(r.text, /<script type="application\/ld\+json">[^<]*"@type":"WebSite"[^<]*"name":"OpenVibe.Tips"/, 'the home says what the site is (JSON-LD)');
assert.match(r.text, /href="\/alex"/);
assert.match(r.text, /href="\/alex"/);
assert.ok(!r.text.includes('href="/bob"'), 'switched-off pages are not listed');
assert.ok(!r.text.includes('href="/bob"'), 'switched-off pages are not listed');
// The home opens with the showcase kit (openvibe-shared/showcase): one h1 (the hero), the kit's sheet, the
// The home opens with the showcase kit (openvibe-shared/showcase): one h1 (the hero), the kit's sheet, the