Blog
The Blog app provides a content publishing system for writing and managing blog articles. It supports categories, draft/published status filtering, and cover images. Articles are displayed in a filterable list with inline category and date metadata.
Key features
Section titled “Key features”- Article management with create, edit, and list views
- Category system for organizing content
- Status filtering with pill-style tabs (All, Draft, Published)
- Cover image support with thumbnail display in the article list
- URL-based filter state — status filters update the URL query string
Page structure
Section titled “Page structure”| Route | Purpose |
|---|---|
/business/apps/blog | Dashboard with status filter tabs and article list |
/business/apps/blog/new | Create a new article |
/business/apps/blog/[id] | Edit an individual article |
/business/apps/blog/categories | Category management |
Data model overview
Section titled “Data model overview”The server load function calls two service functions from $lib/apps/blog/services/index.js:
| Function | Parameters | Description |
|---|---|---|
listMyArticles(userId, { status }) | User ID, optional status filter | Returns articles filtered by status if provided |
listCategories(userId) | User ID | Returns all categories for building the category lookup map |
Each article record includes: id, title, cover_image_url, category_id, status (draft or published), and created_at.
Categories are loaded into a Map<string, BlogCategory> on the client for O(1) lookups when rendering article metadata.
Key components
Section titled “Key components”The page is organized into three main sections:
- Header with “Categories” button and “New Article” button
- Status filter tabs — pill-shaped buttons that call
applyFilter("status", value), which updates the URL search params and triggers a SvelteKit navigation withgotoandreplaceState: true - Article list — a
Cardcontaining clickable rows, each showing a cover image thumbnail (or placeholder icon), title, category name, date, and status badge
Status badges
Section titled “Status badges”- draft —
secondaryvariant - published —
defaultvariant
Notable integrations
Section titled “Notable integrations”- Category lookup map — a
$derivedMapis built from the categories array so each article’scategory_idcan be resolved to a name without re-querying - SvelteKit navigation —
gotowithreplaceState: trueis used for filter changes to avoid polluting browser history - BlogCategory type — imported from
$lib/apps/blog/types/index.jsfor type-safe category handling