/* global React */ // Blog index — data-driven from assets/posts.json const { useState, useEffect } = React; const NS_B = window.GamekeepersCottageDesignSystem_070bc7; const { Eyebrow, Button, Card, Badge } = NS_B; const Photo = window.GKPhoto; const IMG = window.GK_IMG; let _postsCache = null, _postsPromise = null; function loadPosts() { if (_postsCache) return Promise.resolve(_postsCache); if (_postsPromise) return _postsPromise; _postsPromise = (async () => { try { const res = await fetch('assets/posts.json', { cache: 'no-store' }); if (res.ok) { const d = await res.json(); if (d && Array.isArray(d.posts)) { _postsCache = d.posts; return _postsCache; } } } catch (e) { /* fall through */ } if (window.GK_POSTS && Array.isArray(window.GK_POSTS.posts)) { _postsCache = window.GK_POSTS.posts; return _postsCache; } _postsCache = []; return _postsCache; })(); return _postsPromise; } function usePosts() { const initial = _postsCache || (window.GK_POSTS && window.GK_POSTS.posts) || []; const [list, setList] = useState(initial); useEffect(() => { let live = true; loadPosts().then(p => { if (live) setList(p); }); return () => { live = false; }; }, []); return list; } function Stars() { let seed = 7; const rnd = () => (seed = (seed * 9301 + 49297) % 233280) / 233280; const shadows = []; for (let i = 0; i < 90; i++) shadows.push(`${Math.round(rnd() * 100)}vw ${Math.round(rnd() * 320)}px rgba(255,255,255,${(0.3 + rnd() * 0.7).toFixed(2)})`); return ; } function BlogContent() { const posts = usePosts(); const featured = posts.find(p => p.featured); const rest = posts.filter(p => !p.featured); return (
From the wood

Stories, wildlife & things to do

Notes from the cottage and the wood around it — the birds and moths at the feeders, the night sky, and our favourite corners of Suffolk.

{featured && (
{featured.cover ? (
Featured
) : (
Featured
)}
{featured.category}

{featured.title}

{featured.excerpt}

Read the story
)}
{rest.map((p) => (
{p.category}

{p.title}

Read more
))}
); } window.GKmount('blog', BlogContent);