StaticBlog.Template behaviour (StaticBlog v0.2.0)

Copy Markdown View Source

Behaviour that defines the five rendering callbacks a blog template must implement: index, post, category, colophon, and not_found.

The default implementation is StaticBlog.Template.Default. Consumer projects can provide their own module and configure it via config :static_blog, :template, MyApp.Template.

Summary

Callbacks

Render a category page listing posts for a given tag.

Render the colophon (about) page.

Render the blog index page listing all posts.

Render the 404 not-found page.

Render a single post page.

Callbacks

category(tag, posts, site)

@callback category(tag :: String.t(), posts :: [StaticBlog.Post.t()], site :: keyword()) ::
  binary()

Render a category page listing posts for a given tag.

colophon(site)

@callback colophon(site :: keyword()) :: binary()

Render the colophon (about) page.

index(posts, site)

@callback index(posts :: [StaticBlog.Post.t()], site :: keyword()) :: binary()

Render the blog index page listing all posts.

not_found(site)

@callback not_found(site :: keyword()) :: binary()

Render the 404 not-found page.

post(post, site)

@callback post(post :: StaticBlog.Post.t(), site :: keyword()) :: binary()

Render a single post page.