Rewrite page copy across the site, fix nav/blog polish, resize SDK explorer
Restores and rewrites content on Home, Mobile SDK, DNS Protect, Halo CPE, For Operators, Financial Services, Why BlackDice, Investors and Contact to match the approved source copy, removing stray dashes site-wide in favour of plain punctuation. Removes an unreachable duplicate Contact page block that left a stray unclosed <div> in the markup. Shrinks and repads the Guardian Mobile SDK explorer widget so it fits without excess scrolling. Also includes in-progress nav, blog seed and demo scenario tweaks. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -70,11 +70,16 @@ function sanitiseBody(html) {
|
||||
}
|
||||
s = s.replace(/(<br\s*\/?>\s*){3,}/gi, '<br /><br />')
|
||||
s = s.replace(/[ \t]+/g, ' ').replace(/\s*\n\s*/g, '\n').trim()
|
||||
return s
|
||||
return normaliseDashes(s)
|
||||
}
|
||||
|
||||
// House style reads as British English — em dashes read as American, so every
|
||||
// import normalises them to a spaced en dash rather than relying on the studio
|
||||
// draft (or a future re-import) to get it right.
|
||||
const normaliseDashes = (text) => String(text || '').replace(/\s*—\s*/g, ' – ')
|
||||
|
||||
const excerptOf = (post) =>
|
||||
(post.excerpt || sanitiseBody(post.body).replace(/<[^>]*>/g, ' ').replace(/\s+/g, ' ').trim().slice(0, 260)).trim()
|
||||
normaliseDashes((post.excerpt || sanitiseBody(post.body).replace(/<[^>]*>/g, ' ').replace(/\s+/g, ' ').trim().slice(0, 260)).trim())
|
||||
|
||||
// ── Hero extraction ────────────────────────────────────────────────────────────
|
||||
const EXT = { 'image/jpeg': 'jpg', 'image/png': 'png', 'image/webp': 'webp', 'image/gif': 'gif', 'image/svg+xml': 'svg' }
|
||||
@@ -119,7 +124,7 @@ const extraPosts = fs.existsSync(EXTRA) ? JSON.parse(fs.readFileSync(EXTRA, 'utf
|
||||
const posts = (draft.posts || []).map((p) => ({
|
||||
id: p.slug,
|
||||
slug: p.slug,
|
||||
title: p.title || 'Untitled',
|
||||
title: normaliseDashes(p.title || 'Untitled'),
|
||||
category: ['insights', 'news', 'press', 'events'].includes(p.category) ? p.category : 'insights',
|
||||
date: (p.date || '').slice(0, 10),
|
||||
author: p.author || 'BlackDice Cyber',
|
||||
@@ -138,11 +143,15 @@ for (const extra of extraPosts) {
|
||||
}
|
||||
posts.sort((a, b) => (a.date < b.date ? 1 : -1))
|
||||
|
||||
const normalisedContent = Object.fromEntries(
|
||||
Object.entries(draft.content || {}).map(([id, text]) => [id, normaliseDashes(text)]),
|
||||
)
|
||||
|
||||
const seed = {
|
||||
format: 'blackdice-react-content',
|
||||
version: 1,
|
||||
savedAt: draft.savedAt || new Date().toISOString(),
|
||||
content: draft.content || {},
|
||||
content: normalisedContent,
|
||||
images: draft.images || {},
|
||||
numbers: {},
|
||||
posts,
|
||||
|
||||
Reference in New Issue
Block a user