Github Repo v1.0.0


In app.rb includes all the application code. It is recommended you change the AppName.

class AppName < Rack::App
  # Rack::App
  apply_extensions :front_end
  use Rack::ContentType, "text/html"
  use Rack::Cache,
    metastore:    'file:/var/cache/rack/meta',
    entitystore:  'file:/var/cache/rack/body',
    verbose:      true

  # Main App Layout
  layout 'application.html.erb'
  serve_files_from '/app/assets'

  # SEO Meta Tags
  before { 
    @meta_url = '' # used for Open Graph
    @meta_title = ' - Static-Site Framework' 
    @meta_description = '' 
    @meta_author = '' 
    @meta_featured_image = ''

  # Root
  get '/' do
    render 'views/index.html.erb'

  # Pages
  get '/about' do
    render 'views/about.html.erb'


Before { @variables }

All of the variables defined in the before block can be accessed in the views using embedded ruby, for example inside of the application.html.erb file:

<%= @meta_title %>

Layout & assets

The assets folder gets served via the line serve_files_from giving public access to the css, js and image files.

The layout is rendered through the application.html.erb file with layout 'application.html.erb' which is defined for all views.

The content for each page or view is rendered with:

<%= yield %>


To define new routes is very simple just follow the simple format, following the convention of matching the path-name with the file name.

get '/page' do
  render 'views/page.html.erb'

Rack::Cache and ContentType

The ContentType is served as text/html for static websites. Caching the images, css and js files happens via the Rack::Cache gem.

For more information: Rack::App Documentation