Switch to Kramdown, write a blog post
All checks were successful
/ deploy (push) Successful in 4m7s

This commit is contained in:
Aleks Rutins 2025-06-10 22:27:08 -04:00
parent 4b73564dac
commit a4f9dadd8b
Signed by: asr
SSH key fingerprint: SHA256:DBype7RrB3qCdOLdkvecD2Y3THOYgYOVw6jAHVgsGRQ
10 changed files with 58 additions and 17 deletions

View file

@ -2,14 +2,17 @@ module Pages
class Layout < ::Phlex::HTML
def pages = {
home: {
as: :home,
title: "Home",
url: "/"
},
blog: {
as: :blog,
title: "Blog",
url: "/blog"
},
about: {
as: :about,
title: "About",
url: "/about"
}
@ -46,7 +49,7 @@ module Pages
header(class: "#{@banner ? 'fixed' : 'sticky'} top-0 w-screen bg-transparent pointer-events-none flex p-3 items-center justify-center") {
nav(class: 'flex gap-2 p-2 rounded-full border border-gray-300 bg-white/50 backdrop-blur-md pointer-events-auto') {
pages.each { |key, page|
a(href: page[:url], class: "block rounded-full px-3 py-1 #{key == @page ? 'bg-gray-100/50' : ''}") { page[:title] }
a(href: page[:url], class: "block rounded-full px-3 py-1 #{key == @page_info[:as] ? 'bg-gray-100/50' : ''}") { page[:title] }
}
}
}

View file

@ -5,7 +5,7 @@ class Pages::Post < ::Phlex::HTML
end
def view_template
meta = @post[:data].front_matter
render ::Pages::Layout.new({title: meta['title']}) {
render ::Pages::Layout.new({ as: :blog, title: meta['title'] }, banner: meta['banner'], meta: {title: meta['title']}) {
article(class: 'prose prose-lg m-auto') {
h1 { meta['title'] }
if meta['published_on']
@ -19,7 +19,7 @@ class Pages::Post < ::Phlex::HTML
hr
render ::Phlex::Markdown.new(@post[:data].content)
raw safe Kramdown::Document.new(@post[:data].content).to_html
}
}
end