ignitionstack.pro v1.0 is out! Read the announcement →
Skip to Content

Blog Engine

The /[locale]/blog route delivers an MDX-backed blog with featured posts, client-side filtering, and analytics tracking. This page explains the architecture, data flow, and how to extend it safely.

Page Composition

LayerFileResponsibility
Routesrc/app/[locale]/(pages)/blog/page.tsxSets locale, runs SEO helpers, fetches data (featured posts, paginated list, popular tags) via Promise.all, emits Mixpanel page_view.
Featured Postssrc/app/components/blog/featured-posts.tsxDisplays hero cards with CTA + categories.
List + Filterssrc/app/[locale]/(pages)/blog/blog-list-client.tsxClient component handling search, tag filtering, sort (recent, popular, most_read, top_rated).
Post Cardsrc/app/components/blog/post-card.tsxRenders title, excerpt, stats, and link.
MDX Renderingsrc/app/components/blog/post-content.tsxUses ReactMarkdown + rehype-raw/rehype-sanitize, memoized to avoid rerenders.
Engagementpost-reactions.tsx, post-share.tsx, post-rating.tsx, post-engagement-bar.tsxTrack GA4/Mixpanel events for reactions, shares, and reading progress.

Data Pipeline

Client Filtering & Sort

blog-list-client.tsx keeps filters in React state. When the user types or selects a tag, it filters the pre-fetched page of results; sorts by published date, reactions, views, or average rating.

Example snippet:

const [sortBy, setSortBy] = useState<SortOption>('recent'); const filteredPosts = useMemo(() => { // search + tag + sort logic }, [initialPosts.posts, searchQuery, selectedTag, sortBy]);

Analytics & Events

Ensure new interactions register via the analytics event registry (src/app/lib/analytics-events.ts).

SEO Enhancements

Admin & Authoring

Extending the Blog

  1. New Sort Mode – Update SortOption, add case in blog-list-client.tsx, expose translation key (e.g., Blog.filters.sort.top_rated), and update analytics if needed.
  2. Server Pagination – For larger catalogs, implement cursor-based pagination in getPostsList and adjust BlogListClient to fetch more pages via server actions or use streaming.
  3. Localization – Add translated hero copy + filter labels under src/i18n/messages/{locale}.json (Blog.* namespace).
  4. Syndication/blog/rss.xml (see src/app/blog/rss.xml) already exposes RSS; update when adding metadata fields.

Testing

Keep this page updated whenever the blog gains new filters, data sources, or instrumentation so marketing and engineering teams stay aligned.