implement blog

This commit is contained in:
Aleks Rūtiņš 2024-10-06 22:07:20 -04:00
parent b4dcd84581
commit a52f258402
8 changed files with 77 additions and 2 deletions

17
pages/post.rb Normal file
View file

@ -0,0 +1,17 @@
class Pages::Post < ::Phlex::HTML
def initialize(post)
@slug = post[:slug]
@post = post
end
def view_template
meta = @post[:data].front_matter
render ::Pages::Layout.new({title: meta['title']}) {
p {
h1 { meta['title'] }
time(datetime: meta['published_on']) { meta['published_on'] }
render ::Phlex::Markdown.new(@post[:data].content)
}
}
end
end