~afontaine/home

ref: 4f488b8ea4e16b4158e19b15e30d51b84d1f0d81 home/apps/home_web/lib/home_web/views/post_view.ex -rw-r--r-- 560 bytes
4f488b8eAndrew Fontaine Correct hash for Frontend Files 6 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
defmodule HomeWeb.PostView do
  use HomeWeb, :view

  alias Blog.Content.Post

  def markdown(body) do
    body
    |> Earmark.as_html!(code_class_prefix: "language-")
    |> raw()
  end

  def reply_link(%Post{message_id: id, subject: subject}) do
    address = "~afontaine/blog-disucss@lists.sr.ht"

    link(address, to: "mailto:#{address}?in-reply-to=#{id}&subject=Re: #{subject}")
  end

  def title("show.html", %{post: post}) do
    "#{post.subject} · #{post.author}"
  end

  def title("index.html", _) do
    "Andrew Fontaine · All posts"
  end
end