Content

For content-focused sites, use the phlexite-content gem. Here’s an example with a Markdown renderer (using Kramdown):

# ...
require 'kramdown'
require 'phlexite/content'
# ...

class MarkdownPage < ::Phlex::HTML
  def initialize
    # use @front_matter to access the parsed frontmatter of the file
    @title = @front_matter['title']
  end

  def view_template
    html do
      head do
        title { @title }
      end
      body do
        # use @content to access the rest of the text content of the document
        raw safe Kramdown::Document.new(@content, {syntax_highlighter: :rouge}).to_html
      end
    end
  end
end
# ...
# Build all files in the specified glob. Use `prefix:` to strip a prefix from the input path, and `out:` to append a prefix
Phlexite::Content::Collection.new('pages/**/*.md', MarkdownPage, prefix: 'pages').build(s)
# ...

This is fully renderer-agnostic.