[object Object]

← back to Dw Domain Fleet

Render generated AdSense article bodies

77bc6d8dd18ad75699e813f704f76e9b9015f1ec · 2026-09-10 00:54:10 -0700 · Steve Abrams

Files touched

Diff

commit 77bc6d8dd18ad75699e813f704f76e9b9015f1ec
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Thu Sep 10 00:54:10 2026 -0700

    Render generated AdSense article bodies
---
 shared/render.js | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/shared/render.js b/shared/render.js
index 6ca048d..e358ad0 100644
--- a/shared/render.js
+++ b/shared/render.js
@@ -1328,7 +1328,12 @@ ${script(cfg)}
 function articlePage(cfg, a, others) {
   const title = `${a.title} — ${cfg.siteName}`;
   const desc = clean(a.dek || cfg.metaDesc || cfg.tagline);
+  // Generated entries store paragraph prose in `body`; older entries may use
+  // structured `sections`. Support both schemas so articles cannot render empty.
   const sections = Array.isArray(a.sections) ? a.sections : [];
+  const bodyHtml = !sections.length && typeof a.body === 'string'
+    ? a.body.split(/\n\s*\n+/).map(par => `<p>${esc(par.trim())}</p>`).join('')
+    : '';
   const secHtml = sections.map(s =>
     `<h2>${esc(s.h)}</h2>${
       String(s.body || '').split(/\n\n+/).map(par => `<p>${esc(par)}</p>`).join('')
@@ -1350,6 +1355,7 @@ function articlePage(cfg, a, others) {
   <h1>${esc(a.title)}</h1>
   ${a.dek ? `<p class="dek">${esc(a.dek)}</p>` : ''}
   <div class="byline">${esc(cfg.siteName)}${a.readMins ? ` &middot; ${esc(String(a.readMins))} min read` : ''}</div>
+  ${bodyHtml ? `<div class="m-post__body">${bodyHtml}</div>` : ''}
   ${secHtml}
   ${moreHtml}
 </article></div>

← 830fbd9 fleet: Instagram embed on homePage for patterndesignlab + ho  ·  back to Dw Domain Fleet  ·  Record article rendering fix proof f71119f →