JOL/lib/jol/blog.ex

20 lines
460 B
Elixir

defmodule JOL.Blog do
alias JOL.Blog.Post
alias JOL.Blog.Parser
use NimblePublisher,
build: JOL.Blog.Post,
from: Application.app_dir(:jol, "priv/posts/**/*.md"),
parser: Parser,
as: :posts,
@posts Enum.sort_by(@posts, & &1.date, {:desc, Date})
@tags @posts |> Enum.flat_map(& &1.tags) |> Enum.uniq() |> Enum.sort()
@spec posts() :: []
def posts, do: @posts
@spec unique_tag_list() :: []
def unique_tag_list, do: @tags
end