'}
${escapeHtml(journey.title)}
${escapeHtml(journey.description || journey.markers?.[0]?.text?.substring(0, 150) + '…')}
let allJourneys = []; // ==================== LOAD JOURNEYS ==================== async function loadJourneys() { try { const res = await fetch(`${API_BASE}/journeys`, { credentials: 'include' }); if (!res.ok) throw new Error('Failed to fetch journeys'); const journeys = await res.json(); allJourneys = journeys; renderJourneys(journeys); } catch (err) { console.error(err); document.getElementById('posts-grid').innerHTML = '
Failed to load journeys. Make sure the backend is running.
'; } } function renderJourneys(journeys) { const container = document.getElementById('posts-grid'); if (!journeys.length) { container.innerHTML = `No journeys yet. Create one on the map!