openvibers/openvibe.blog Commits
Blog: the home page has one h1 (the blog title under the showcase is an h2) (#51)
Changes
@@@ -146,6 +146,7 @@ function createPublicRoutes(ctx) {blog, blogUrl: `/@${blog.handle}`, items, pager, feeds,series: seriesShown, categories: await prune(await reading.categoriesTree(blog)),canWrite: await access.canWrite(store, req.viewer, blog, 'create'),++ showcase: home && pager.page === 1,}) + (home && pager.page === 1 ? frame.shipped({ service: 'blog', title: 'Recently shipped on OpenVibe.Blog' }) : ''),}, { cacheable: !scope.restricted && !scope.restrictedAuthor });}@@@ -57,10 +57,10 @@ function feedLinksHtml(feeds) {return h`<p class="feeds">Follow: ${feeds.map((f) => h`<a href="${f.href}" type="${f.mime}">${f.label}</a> `)}</p>`;}--/** A blog's front page. */--function blogIndex({ blog, blogUrl, items, pager, feeds, series, categories, canWrite }) {++/** A blog's front page. Under the network blog's showcase (its hero is the page's h1) the blog's title is an h2. */++function blogIndex({ blog, blogUrl, items, pager, feeds, series, categories, canWrite, showcase = false }) {return String(h`<header class="blog-header">--<h1>${blog.title}</h1>++${showcase ? h`<h2>${blog.title}</h2>` : h`<h1>${blog.title}</h1>`}${blog.description ? h`<p class="lede">${blog.description}</p>` : ''}${raw(feedLinksHtml(feeds))}${canWrite ? h`<p><a class="button" href="/write/@${blog.handle}">Write on this blog</a></p>` : ''}@@@ -60,7 +60,10 @@ const split = (html) => ({ head: html.slice(0, html.indexOf('</head>')), body: hconst { head } = split((await t.get('/write', { as: eve })).text);assert.strictEqual(count(head, /<title>/g), 1);assert.ok(/<meta name="robots" content="noindex[^"]*">/.test(head), 'the editor is noindex');-- const home = split((await t.get('/')).text).head;++ const homePage = (await t.get('/')).text;++ const home = split(homePage).head;++ // The showcase hero is the page's one h1; the blog's own title under it is an h2.++ assert.strictEqual(count(homePage, /<h1\b/g), 1, 'one h1 on the home');assert.strictEqual(count(home, /<title>/g), 1);assert.ok(home.includes('<link rel="canonical" href="https://openvibe.blog/">'));// The home carries the Blog JSON-LD and, since llms-full.txt, the site summary's WebPage JSON-LD.
@@ -146,6 +146,7 @@ function createPublicRoutes(ctx) {
@@ -146,6 +146,7 @@ function createPublicRoutes(ctx) {
blog, blogUrl: `/@${blog.handle}`, items, pager, feeds,
blog, blogUrl: `/@${blog.handle}`, items, pager, feeds,
series: seriesShown, categories: await prune(await reading.categoriesTree(blog)),
series: seriesShown, categories: await prune(await reading.categoriesTree(blog)),
canWrite: await access.canWrite(store, req.viewer, blog, 'create'),
canWrite: await access.canWrite(store, req.viewer, blog, 'create'),
+ showcase: home && pager.page === 1,
}) + (home && pager.page === 1 ? frame.shipped({ service: 'blog', title: 'Recently shipped on OpenVibe.Blog' }) : ''),
}) + (home && pager.page === 1 ? frame.shipped({ service: 'blog', title: 'Recently shipped on OpenVibe.Blog' }) : ''),
}, { cacheable: !scope.restricted && !scope.restrictedAuthor });
}, { cacheable: !scope.restricted && !scope.restrictedAuthor });
}
}
@@ -57,10 +57,10 @@ function feedLinksHtml(feeds) {
@@ -57,10 +57,10 @@ function feedLinksHtml(feeds) {
return h`<p class="feeds">Follow: ${feeds.map((f) => h`<a href="${f.href}" type="${f.mime}">${f.label}</a> `)}</p>`;
return h`<p class="feeds">Follow: ${feeds.map((f) => h`<a href="${f.href}" type="${f.mime}">${f.label}</a> `)}</p>`;
}
}
-/** A blog's front page. */
-function blogIndex({ blog, blogUrl, items, pager, feeds, series, categories, canWrite }) {
+/** A blog's front page. Under the network blog's showcase (its hero is the page's h1) the blog's title is an h2. */
+function blogIndex({ blog, blogUrl, items, pager, feeds, series, categories, canWrite, showcase = false }) {
return String(h`<header class="blog-header">
return String(h`<header class="blog-header">
-<h1>${blog.title}</h1>
+${showcase ? h`<h2>${blog.title}</h2>` : h`<h1>${blog.title}</h1>`}
${blog.description ? h`<p class="lede">${blog.description}</p>` : ''}
${blog.description ? h`<p class="lede">${blog.description}</p>` : ''}
${raw(feedLinksHtml(feeds))}
${raw(feedLinksHtml(feeds))}
${canWrite ? h`<p><a class="button" href="/write/@${blog.handle}">Write on this blog</a></p>` : ''}
${canWrite ? h`<p><a class="button" href="/write/@${blog.handle}">Write on this blog</a></p>` : ''}
@@ -60,7 +60,10 @@ const split = (html) => ({ head: html.slice(0, html.indexOf('</head>')), body: h
@@ -60,7 +60,10 @@ const split = (html) => ({ head: html.slice(0, html.indexOf('</head>')), body: h
const { head } = split((await t.get('/write', { as: eve })).text);
const { head } = split((await t.get('/write', { as: eve })).text);
assert.strictEqual(count(head, /<title>/g), 1);
assert.strictEqual(count(head, /<title>/g), 1);
assert.ok(/<meta name="robots" content="noindex[^"]*">/.test(head), 'the editor is noindex');
assert.ok(/<meta name="robots" content="noindex[^"]*">/.test(head), 'the editor is noindex');
- const home = split((await t.get('/')).text).head;
+ const homePage = (await t.get('/')).text;
+ const home = split(homePage).head;
+ // The showcase hero is the page's one h1; the blog's own title under it is an h2.
+ assert.strictEqual(count(homePage, /<h1\b/g), 1, 'one h1 on the home');
assert.strictEqual(count(home, /<title>/g), 1);
assert.strictEqual(count(home, /<title>/g), 1);
assert.ok(home.includes('<link rel="canonical" href="https://openvibe.blog/">'));
assert.ok(home.includes('<link rel="canonical" href="https://openvibe.blog/">'));
// The home carries the Blog JSON-LD and, since llms-full.txt, the site summary's WebPage JSON-LD.
// The home carries the Blog JSON-LD and, since llms-full.txt, the site summary's WebPage JSON-LD.