function InsightsPage({ onGo, onOpenPost }) { const D = window.DATA; const [filter, setFilter] = useState("All"); const [posts, setPosts] = useState(D.posts || []); const filters = ["All", "Strategy", "Performance", "SEO", "Creative", "Teardown", "Thinking", "Playbook"]; const shown = filter === "All" ? posts : posts.filter(p => p.tag === filter); useEffect(() => { let mounted = true; (async () => { try { const wp = await getWordPressPosts(); if (!mounted || !wp) return; const mapped = wp.map(p => ({ tag: (p._embedded && p._embedded['wp:term'] && p._embedded['wp:term'][0] && p._embedded['wp:term'][0][0] && p._embedded['wp:term'][0][0].name) || 'Thinking', date: new Date(p.date).toLocaleString(undefined, { month: 'short', year: 'numeric' }), title: p.title || '', read: p.excerpt ? p.excerpt.replace(/<[^>]+>/g, '').slice(0, 120) + '...' : '', feature: false, img: p.coverImage || null, content: p.content || '', })); if (mapped.length) setPosts(mapped); } catch (e) { console.warn('WP posts load failed', e); } })(); return () => { mounted = false }; }, []); return ( <>
Insights · long-form

Notes from inside the growth machine.

Monthly essays on strategy, performance, SEO, and the craft of building brands that compound. Written for operators, read by founders.

{filters.map((t) => ( ))}
{shown.map((p, i) => (
onOpenPost(p)} style={p.img ? { backgroundImage: `url(${p.img})` } : undefined} />
{p.tag} {p.date}

onOpenPost(p)}>{p.title}

onOpenPost(p)}>{p.read}
))}

Get the monthly note.

One essay a month. No tips & tricks. No funnel hacks. Just sharp thinking about growth.

); } function PostPage({ post, onGo, onOpenPost }) { const D = window.DATA; const related = D.posts.filter(p => p.title !== post.title).slice(0, 3); const [tocItems, setTocItems] = useState([]); const [bodyHtml, setBodyHtml] = useState(post.content || ''); const bodyClassName = tocItems.length > 0 ? 'post-body' : 'post-body post-body--no-toc'; function slugifyHeading(text) { return String(text || '') .toLowerCase() .trim() .replace(/[^a-z0-9]+/g, '-') .replace(/^-+|-+$/g, ''); } useEffect(() => { if (!post.content) { setTocItems([]); setBodyHtml(''); return; } const parser = new DOMParser(); const doc = parser.parseFromString(post.content, 'text/html'); const headings = Array.from(doc.querySelectorAll('h2, h3')); const items = headings.map((heading, index) => { const text = heading.textContent.trim(); const id = heading.id || `heading-${index}-${slugifyHeading(text)}`; heading.id = id; return { id, text: text || `Section ${index + 1}`, level: heading.tagName.toLowerCase() === 'h3' ? 3 : 2, }; }); setTocItems(items); setBodyHtml(doc.body.innerHTML); }, [post.content]); // Generate reading progress const [progress, setProgress] = useState(0); useEffect(() => { const onScroll = () => { const el = document.getElementById("article-body"); if (!el) return; const rect = el.getBoundingClientRect(); const total = el.offsetHeight - window.innerHeight; const scrolled = Math.min(Math.max(-rect.top, 0), total); setProgress(total > 0 ? (scrolled / total) * 100 : 0); }; window.addEventListener("scroll", onScroll, { passive: true }); onScroll(); return () => window.removeEventListener("scroll", onScroll); }, [post.title]); return ( <> {/* Reading progress */}
{/* Hero */}
{post.tag} · {post.date} · {post.read}

{post.title}

S
Stanzin
Growth Partner · Bengaluru
{/* Feature image */}
{/* Body */}
{tocItems.length > 0 && ( )} {/* Article */}
{bodyHtml ? (
) : ( <>

No post body available yet.

Please publish the post with valid body content from the WordPress CMS.

)}
{/* Author card */}
S
Stanzin

Independent growth partner for D2C brands and B2B SaaS teams. Seven years inside growth functions. Currently consulting with six brands from Bengaluru.

{/* Related */}
{related.map((p, i) => (
onOpenPost(p)} style={p.img ? { backgroundImage: `url(${p.img})` } : undefined} />
{p.tag} {p.date}

onOpenPost(p)}>{p.title}

onOpenPost(p)}>{p.read}
))}

Get the monthly note.

); } window.InsightsPage = InsightsPage; window.PostPage = PostPage;