basic content

This commit is contained in:
Aleks Rūtiņš 2024-09-09 12:12:42 -04:00
parent 3133275bcc
commit 057cca96d6
7 changed files with 114 additions and 30 deletions

View file

@ -1,18 +1,40 @@
module Pages
class Layout < ::Phlex::HTML
def initialize(title)
@title = title
def pages = {
home: {
title: "Home",
url: "/"
},
blog: {
title: "Blog",
url: "/blog"
},
about: {
title: "About",
url: "/about"
}
}
def initialize(page)
@page = page
end
def view_template
doctype
html {
head {
title { @title + " | Aleks Rūtiņš" }
title { pages[@page][:title] + " | Aleks Rūtiņš" }
meta(charset: "utf-8")
meta(name: "viewport", content: "width=device-width, initial-scale=1.0")
link(rel: "stylesheet", href: "/site.css")
}
body {
header {
nav {
pages.each { |key, page|
a(href: page[:url], class: key == @page ? "active" : "") { page[:title].downcase }
}
}
}
yield
}
}