PhoenixKitWeb.Live.Modules.Blogging.Metadata (phoenix_kit v1.6.16)
View SourceMetadata helpers for .phk (PhoenixKit) blogging posts.
Metadata is stored as a simple key-value format at the top of the file:
---
slug: home
title: Welcome
status: published
published_at: 2025-10-29T18:48:00Z
---
Content goes here...
Summary
Functions
Returns default metadata for a new post.
Extracts title from markdown content. Looks for the first H1 heading (# Title) within the first few lines. Falls back to the first line if no H1 found.
Parses .phk content, extracting metadata from frontmatter and returning the content. Title is extracted from the markdown content itself (first H1 heading).
Serializes metadata as YAML-style frontmatter. Note: Title is NOT saved in frontmatter - it's extracted from content.
Types
@type metadata() :: %{ status: String.t(), title: String.t(), description: String.t() | nil, slug: String.t(), published_at: String.t(), featured_image_id: String.t() | nil, created_at: String.t() | nil, created_by_id: String.t() | nil, created_by_email: String.t() | nil, updated_by_id: String.t() | nil, updated_by_email: String.t() | nil }
Functions
@spec default_metadata() :: metadata()
Returns default metadata for a new post.
Extracts title from markdown content. Looks for the first H1 heading (# Title) within the first few lines. Falls back to the first line if no H1 found.
Parses .phk content, extracting metadata from frontmatter and returning the content. Title is extracted from the markdown content itself (first H1 heading).
Serializes metadata as YAML-style frontmatter. Note: Title is NOT saved in frontmatter - it's extracted from content.