GameServer.Content
(GameServer v1.0.637)
Copy Markdown
Reads and renders Markdown content from files/directories configured
in the theme JSON config ("changelog" and "blog" keys).
Paths are resolved relative to the project working directory.
All content is cached in :persistent_term after the first read.
Call reload/0 to invalidate everything (e.g. after a config change).
Summary
Functions
Returns the resolved absolute path to the blog directory, or nil.
Returns {prev_post, next_post} neighbours for the given slug (newest-first order).
Either may be nil.
Renders a blog post's markdown to HTML, or nil.
Groups blog posts by {year, month} (newest first).
Returns a list of {year, [{month, [posts]}]}.
Returns the rendered changelog HTML, or nil when the changelog path is
not configured or the file doesn't exist.
Returns the resolved absolute path to the changelog file, or nil.
Returns the absolute path for a content asset (image etc.) relative to the
blog or changelog directory. Returns nil when not found or path traversal
is attempted.
Returns a single blog post map by slug, or nil.
Lists all blog posts sorted newest-first.
Clears all cached content so the next call re-reads from disk.
Functions
@spec blog_dir() :: String.t() | nil
Returns the resolved absolute path to the blog directory, or nil.
Returns {prev_post, next_post} neighbours for the given slug (newest-first order).
Either may be nil.
Renders a blog post's markdown to HTML, or nil.
Groups blog posts by {year, month} (newest first).
Returns a list of {year, [{month, [posts]}]}.
@spec changelog_html() :: String.t() | nil
Returns the rendered changelog HTML, or nil when the changelog path is
not configured or the file doesn't exist.
@spec changelog_path() :: String.t() | nil
Returns the resolved absolute path to the changelog file, or nil.
Returns the absolute path for a content asset (image etc.) relative to the
blog or changelog directory. Returns nil when not found or path traversal
is attempted.
Returns a single blog post map by slug, or nil.
@spec list_blog_posts() :: [map()]
Lists all blog posts sorted newest-first.
Each post is a map with keys:
:slug– URL-safe identifier derived from the filename:title– extracted from the first#heading (or humanised slug):date–Date.t()parsed from filename prefix or file mtime:path– absolute path to the.mdfile:excerpt– first non-heading paragraph (≤ 200 chars)
@spec reload() :: :ok
Clears all cached content so the next call re-reads from disk.