JOL/lib/jol/blog.ex

20 lines
460 B
Elixir
Raw Normal View History

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