Files
adamantium/app/views/pages/show.rb
2023-01-27 22:55:09 +11:00

18 lines
426 B
Ruby

module Adamantium
module Views
module Pages
class Show < Adamantium::View
include Deps[renderer: "renderers.markdown"]
expose :page_content do |slug:|
markdown_content = File.read("app/content/pages/#{slug}.md")
renderer.call(content: markdown_content)
rescue Errno::ENOENT
renderer.call(content: "## Page not found")
end
end
end
end
end