farthergate.com/pages/blog.rb

25 lines
631 B
Ruby

class Pages::Blog < ::Phlex::HTML
include Util::PostLoader
def view_template
render ::Pages::Layout.new(:blog, banner: '/trees.jpg') {
h1(class: 'font-bold text-center') { 'Blog' }
table {
posts.each { |post|
meta = post[:data].front_matter
return unless meta.key?('published_on')
tr {
td {
time(datetime: meta['published_on'], class: 'text-gray-500') { meta['published_on'] }
}
td {
a(href: '/p/' + post[:slug], class: 'pl-2') { meta['title'] }
}
}
}
}
}
end
end