StaticBlog (StaticBlog v0.2.0)

Copy Markdown View Source

A reusable static blog engine for Elixir.

StaticBlog provides the core infrastructure for building, previewing, and publishing a static blog. Each consumer project adds this library as a dependency, supplies its own content in priv/posts/, and configures site metadata under the :static_blog application key.

The primary public API is site_config/0, consumer_app/0, template_module/0, and all_posts/0.

Summary

Functions

Returns all blog posts.

Returns the consumer application atom.

Returns the site configuration keyword list.

Returns the template module to use for rendering.

Functions

all_posts()

@spec all_posts() :: [StaticBlog.Post.t()]

Returns all blog posts.

If a :blog_module is configured, delegates to that module's all_posts/0 function. Otherwise falls back to StaticBlog.RuntimePosts.all/0 which reads from disk at runtime.

Returns

consumer_app()

@spec consumer_app() :: atom()

Returns the consumer application atom.

This is the OTP application that owns the priv/posts/ and priv/static/ directories. Configured via config :static_blog, :app, :my_blog.

Returns

  • The consumer app atom from config :static_blog, :app.

site_config()

@spec site_config() :: keyword()

Returns the site configuration keyword list.

Returns

  • A keyword list of site-wide settings from config :static_blog, :site.

template_module()

@spec template_module() :: module()

Returns the template module to use for rendering.

Defaults to StaticBlog.Template.Default if not configured.

Returns