Nabo v0.0.2 Nabo.Repo behaviour View Source
Precompiles and provides interface to interact with your posts.
defmodule MyRepo do
use Nabo.Repo, root: "priv/posts"
end
{:ok, posts} = MyRepo.all
{:ok, post} = MyRepo.get("foo")
post = MyRepo.get!("foo")
Compiler
By default Nabo uses Nabo.Compilers.Markdown
compiler.
To customize compiler or compiler options, use :compiler
option.
defmodule MyRepo do
use Nabo.Repo,
root: "priv/posts",
compiler: {
Nabo.Compilers.Markdown,
markdown: %Earmark.Options{smartypants: false}
}
end
See Nabo.Compiler
more more information of how to build your own compiler.
Link to this section Summary
Callbacks
Fetches all available posts in the repo
Fetches all availables post names in the repo
Finds a post by the given slug
Similar to get/1
but raises error when no post was found
Link to this section Callbacks
Link to this callback
get(name)
View Source
get(name :: String.t) :: {:ok, Nabo.Post.t} | {:error, any}
Finds a post by the given slug.
Example
{:ok, post} = MyRepo.get("my-slug")