feat!: render the post page on the shared SEO layer with one H1 in both Journal H1 modes (tracer)
- extend vue-seo-layer (link dependency during development) and drop
@nuxtjs/seo: the page head, canonical and the one JSON-LD graph come
from the CMS resolve answer; the post's own title, excerpt and image
apply only while there is no CMS answer
- remove the journal sitemap source and the copied shared purge route,
library and plugin (the SEO layer serves POST /api/__site__/cache/purge);
the deprecated POST /api/__journal__/cache/purge keeps working
- post title is h1 while the Journal API reports content_h1_to_h2 on
(or absent) and p.journal-post__title while off; journal.postTitleTag
('auto' | 'h1' | 'p') overrides it; body h1 headings are demoted to h2
while the setting is on (gateJournalHtml/sanitizeJournalHtml demoteH1)
- journal.breadcrumbs option and post-title CSS tokens
- smoke harness: count=, header=, noheader= and resolves lines; the
fixture API also answers the SEO resolve and site endpoints
BREAKING CHANGE: the layer no longer installs @nuxtjs/seo (no
nuxt-site-config, nuxt-schema-org, robots or sitemap module, no
/api/__sitemap__/journal source, no useSiteConfig()); apps take their
head, sitemaps and robots from the SEO plugin through vue-seo-layer.
This commit is contained in:
@@ -333,3 +333,25 @@ test('every corpus entry stays free of danger after the sink pipeline', () => {
|
||||
for (const pattern of DANGER) assert.doesNotMatch(out, pattern, `${entry.name}: ${pattern}`)
|
||||
}
|
||||
})
|
||||
|
||||
// The Journal H1 setting (UI-SPEC L7 step 1): with demoteH1 every h1 comes
|
||||
// out as an h2 with its filtered attributes; without it the h1 stays.
|
||||
test('demoteH1 true turns body h1 headings into h2 and keeps the rest', () => {
|
||||
const html = '<h1 id="start" class="lead" onclick="x()">Start</h1><h2>Two</h2><p>Text <strong>h1</strong></p><h1>Again</h1>'
|
||||
const out = sanitizeJournalHtml(html, { demoteH1: true })
|
||||
assert.equal(out, '<h2 id="start" class="lead">Start</h2><h2>Two</h2><p>Text <strong>h1</strong></p><h2>Again</h2>')
|
||||
assert.doesNotMatch(out, /<h1/)
|
||||
assert.deepEqual(gateJournalHtml(html, { demoteH1: true }), { safe: false, html: out })
|
||||
})
|
||||
|
||||
test('demoteH1 false or absent keeps body h1 headings as written', () => {
|
||||
const html = '<h1 id="start">Start</h1><h2>Two</h2>'
|
||||
assert.equal(sanitizeJournalHtml(html), html)
|
||||
assert.equal(sanitizeJournalHtml(html, { demoteH1: false }), html)
|
||||
assert.deepEqual(gateJournalHtml(html, { demoteH1: false }), { safe: true, html })
|
||||
})
|
||||
|
||||
test('the demotion is not a removal: safe HTML stays safe while demoted', () => {
|
||||
const html = '<h1>Start</h1><p>Text</p>'
|
||||
assert.deepEqual(gateJournalHtml(html, { demoteH1: true }), { safe: true, html: '<h2>Start</h2><p>Text</p>' })
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user