import { useEffect } from "react"; import { Link, useParams } from "react-router-dom"; import SkyCanvas from "../components/SkyCanvas"; import { PublicFooter, PublicNav } from "../components/PublicChrome"; import { blogPosts, getPost } from "../content/blogPosts"; function useMeta(title: string, description: string, canonical?: string) { useEffect(() => { document.title = title; const set = (selector: string, attr: string, value: string, create: () => HTMLElement) => { let el = document.head.querySelector(selector) as HTMLElement | null; if (!el) { el = create(); document.head.appendChild(el); } el.setAttribute(attr, value); }; set('meta[name="description"]', "content", description, () => { const m = document.createElement("meta"); m.setAttribute("name", "description"); return m; }); set('link[rel="canonical"]', "href", `${window.location.origin}${canonical ?? window.location.pathname}`, () => { const l = document.createElement("link"); l.setAttribute("rel", "canonical"); return l; }); }, [title, description, canonical]); } const fmtDate = (d: string) => new Date(`${d}T00:00:00Z`).toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric", timeZone: "UTC" }); export function Blog() { useMeta("Blog | Notestack", "Field notes on turning your writing into research, audio, video and launches."); return (

Blog

Field notes

Guides for writers who want their archive to work harder: research, audio, video and distribution.

{blogPosts.map((p) => ( {p.heroImage && {p.heroImageAlt} {p.category} · {fmtDate(p.publishedAt)} · {p.readTime}

{p.title}

{p.description}

))}
); } export function BlogPostPage() { const { slug = "" } = useParams(); const post = getPost(slug); useMeta(post ? `${post.title} | Notestack` : "Not found | Notestack", post?.description ?? "", post?.canonicalPath); if (!post) { return (

Lost in space

That post drifted out of range.

Back to the blog
); } const related = post.relatedPaths .map((path) => blogPosts.find((p) => `/blogs/${p.slug}` === path)) .filter((p): p is NonNullable => Boolean(p)); const jsonLd = { "@context": "https://schema.org", "@type": "BlogPosting", headline: post.title, description: post.description, datePublished: post.publishedAt, author: { "@type": "Organization", name: "Notestack" }, }; const faqLd = post.faq.length ? { "@context": "https://schema.org", "@type": "FAQPage", mainEntity: post.faq.map((f) => ({ "@type": "Question", name: f.question, acceptedAnswer: { "@type": "Answer", text: f.answer }, })), } : null; return (
{faqLd && } Blog / {post.category}

{post.heroEyebrow}

{post.heroTitle}

{post.heroDescription}

{fmtDate(post.publishedAt)} · {post.readTime}

{post.heroImage && {post.heroImageAlt}
{post.sections.map((s) => (

{s.heading}

{s.paragraphs.map((para, i) => (

{para}

))} {s.bullets && (
    {s.bullets.map((b) => (
  • {b}
  • ))}
)} {s.callout &&
{s.callout}
}
))} {post.faq.length > 0 && (

Questions

{post.faq.map((f) => (
{f.question}

{f.answer}

))}
)}
{related.length > 0 && (

Keep reading

{related.map((p) => (

{p.title}

{p.description}

))}
)}
); }