Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
executable file 78 lines (57 sloc) 2.02 KB
Helper for printing headers
- header.title = Sets current page title
- header.title_separator = Page title separator, defaults to ' / '
- header.charset = Sets page charset, defaults to 'utf-8'
Examples say it all
= header.add
- Adds javascript or stylesheet to header. If it finds .css uses stylesheet_link_tag else javascript_include_tag.
- header.add 'admin.css', '', 'wymeditor/jquery.wymeditor.min.js'
= 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
=, 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>
header.add 'site.css', 'local.js'
header.description 'My beautiful site'
header.icon '/images/icon-32.png', 32
header.title 'Homepage'
= 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
- js method is jQuery or prototype "aware" and wraps code accordingly
- facebook helpers for facebook pages and icons
Copyright (c) 2011 [Dino Reic (dux)], released under the MIT license
Jump to Line
Something went wrong with that request. Please try again.