Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
easy and clean valid html header generator
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
README
README.markdown

README.markdown

Header-print

Helper for printing headers

Options

  • header.title = Sets current page title
  • header.title_separator = Page title separator, defaults to ' / '
  • header.charset = Sets page charset, defaults to 'utf-8'

Example

Examples say it all

= header.add

= header.js

  • Adds javascript

= header.css

  • Adds stylesheet

= header.add :jquery

  • Adds latest jquery from google cdn

= header.description

  • adds description to page, trims if size is larger then 156 characters beacause that is google limit
  • header.description 'Just mind to put less then 157 characters'
  • if you need more than 156 chars use header.meta

= header.icon(location='/favicon.ico', size=nil)

  • defaults to '/favicon.ico'
  • size defines larger icons, for example google applications

= header.meta(name, content)

  • adds generic meta content

= header.property(name, content)

  • adds generic meta content
  • facebook uses that

= header.rss(link, title='RSS feed')

  • adds RSS feed

= header.print(page_title) Prints page header, should be in head section

Full HAML example

:ruby code should be of course be in controller

<!DOCTYPE html>
:ruby
  header.description 'My beautiful site'
  header.title 'Homepage'
%html
       %head
         - header.icon
         - header.icon '/images/icon-32.png', 32
         - header.add 'site.css', 'local.js'
         = header.print 'My site'

Future improvements

  • yield block prints script in the footer
  • js and css methods that print javascript in the footer and css in the header
  • facebook helpers for facebook pages and icons

Copyright (c) 2011 [Dino Reic (dux)], released under the MIT license http://twitter.com/dux

Something went wrong with that request. Please try again.