0.0
No release in over 3 years
An embeddable static pages engine for Rails apps and the devil
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

 Project Readme

Satanic Pages

Static Markdown pages with YAML frontmatter and inline Erb, embedded in your Rails app.

As simple as, …
app/views/pages/exorcism_tips.html.md:

---
title: 3 tips for the PERFECT exorcism
author: Beelzebub
tags:
- listicles
- devil worship
- activity ideas
---
By <%= data.author %>.

Through trial and error, I've found that the perfect exorcism
starts with a refreshing drink.

Tagged <%= render "tag_list", tags: data.tags %>:

## Devilishly good lemonade recipe

Usage

In app/views/layouts/pages.html.erb:

<%= render_layout "application" do %>
  <h1><%= data.title %></h1>
  <article>
    <%= yield %>
  </article>
<% end %>

Frontmatter is supplied as a struct like object.

Given this frontmatter:

---
author: Beelzebub
---

Use ! and ? method helpers for added strictness.

data.author  # => "Beelzebub"
data.author! # => "Beelzebub"
data.author? # => true

data.title   # => nil
data.title!  # => raises SatanicPages::Frontmatter::MissingAttributeError
data.title?  # => false

Installation

Add this line to your application's Gemfile:

$ bundle add satanic_pages
$ bundle install

Add the Concern to a regular controller:

class PagesController < ApplicationController
  include SatanicPages::Controller
end

And set up a wildcard route:

get("*page", to: "pages#show", as: :page, constraints: PagesController.constraint)

License

MIT