Skip to content
Browse files

Added some SEO features; cleaned up page and head title.

  • Loading branch information...
1 parent edc51bd commit ff133caba423c7799d6e3fd2f5befc333b9cde55 @djnawara committed
View
24 app/views/layouts/application.html.haml
@@ -2,22 +2,7 @@
!!! XML
!!! Strict
%html
- %head
- %meta{'http-equiv' => 'Content-Type', :content => 'text/html;charset=UTF-8'}
- = stylesheet_link_tag 'application', 'administration', :plugin => 'natto'
- /[if lte IE 7]
- = stylesheet_link_tag "ie"
- - if !@page.nil?
- - @page.get_sass.each do |file|
- = stylesheet_link_tag file
- = javascript_include_tag 'prototype', 'effects', 'dragdrop', 'controls', 'admin', 'application', "tiny_mce/embed.js", :cache => false, :plugin => 'natto'
- = yield :javascript
- :javascript
- document.observe("dom:loaded",function(ev){
- #{'admin = new DJN.Admin();' if logged_in? && current_user.is_administrator?}
- #{yield :onReady}
- });
- = yield :head
+ %head= render :partial => 'shared/head'
%body
#page
#header
@@ -26,13 +11,10 @@
#site_title= link_to(Natto.site_title, root_path)
#navigation= render :partial => 'shared/navigation'
#content
- - # let's only show the h1 tag if there is title content to display;
- - # we don't want to require passing it explicitly
- - unless @content_for_page_title.blank?
- %h1#page_title~ yield(:page_title)
+ %h1#page_title= render :partial => 'shared/page_title'
= render :partial => 'shared/admin_toolbar'
= render :partial => 'shared/location'
- = render :partial => "shared/notices"
+ = render :partial => 'shared/notices'
= yield
#footer
= link_to('Sitemap', sitemap_path)
View
2 app/views/pages/biography.html.haml
@@ -1,5 +1,3 @@
-- # do some setup
-- content_for :page_title, "Our People"
- # collect args for next call
- args = params[:args]
- args = args[0] unless args.nil?
View
2 app/views/pages/blog.html.haml
@@ -1,6 +1,4 @@
- content_for :javascript, javascript_include_tag('treemenu', :plugin => 'natto')
-- content_for :title, @object.title
-- content_for :page_title, @object.title
#blog
#blog_posts
- get_recent_posts(@object).each do |post| # render recent posts for the page
View
2 app/views/pages/news.html.haml
@@ -1,6 +1,4 @@
- content_for :javascript, javascript_include_tag('treemenu', :plugin => 'natto')
-- content_for :title, @object.title
-- content_for :page_title, @object.title
#blog
#blog_posts
- get_recent_posts(@object).each do |post| # render recent posts for the page
View
3 app/views/pages/portfolio.html.haml
@@ -1,6 +1,3 @@
-- content_for :head do
- %title= "#{Natto.site_title} - #{@object.title}"
-- content_for :page_title, @object.title
- # render all projects for the portfolio
- if logged_in? && current_user.is_administrator?
.toolbar= link_to(sort_icon('Organize your projects'), project_positions_path)
View
4 app/views/pages/show.html.haml
@@ -1,3 +1 @@
-- content_for :title, @object.title
-- content_for :page_title, @object.title
-= @object.content
+= @page.content
View
38 app/views/shared/_head.html.haml
@@ -0,0 +1,38 @@
+- # build SEO meta tags
+%meta{'http-equiv' => 'Content-Type', :content => 'text/html;charset=UTF-8'}
+- if @content_for_description.blank?
+ - unless @page.nil? || @page.description.blank?
+ - description = @page.description
+- else
+ - description = yield(:description)
+- if @content_for_keywords.blank?
+ -unless @page.nil? || @page.keywords.blank?
+ - keywords = @page.keywords
+- else
+ - keywords = yield(:keywords)
+%meta{:name => "description", :content => description }
+%meta{:name => "keywords", :content => keywords }
+- # build our browser title
+%title
+ = Natto.site_title
+ - if @content_for_title.blank?
+ - unless @page.nil? || @page.title.blank?
+ »
+ = @page.title
+ - else
+ »
+ = yield :title
+= stylesheet_link_tag 'application', 'administration', :plugin => 'natto'
+/[if lte IE 7]
+ = stylesheet_link_tag "ie"
+- if !@page.nil?
+ - @page.get_sass.each do |file|
+ = stylesheet_link_tag file
+= javascript_include_tag 'prototype', 'effects', 'dragdrop', 'controls', 'admin', 'application', "tiny_mce/embed.js", :cache => false, :plugin => 'natto'
+= yield :javascript
+:javascript
+ document.observe("dom:loaded",function(ev){
+ #{'admin = new DJN.Admin();' if logged_in? && current_user.is_administrator?}
+ #{yield :onReady}
+ });
+= yield :head
View
7 app/views/shared/_page_title.html.haml
@@ -0,0 +1,7 @@
+- # let's only show the h1 tag if there is title content to display;
+- # we don't want to require passing it explicitly
+- if @content_for_page_title.blank?
+ - unless @page.nil? || @page.title.blank?
+ ~ @page.title
+- else
+ ~ yield(:page_title)
View
9 db/migrate/025_alter_pages_add_keywords.rb
@@ -0,0 +1,9 @@
+class AlterPagesAddKeywords < ActiveRecord::Migration
+ def self.up
+ add_column :pages, :keywords, :string
+ end
+
+ def self.down
+ remove_column :pags, :keywords
+ end
+end

0 comments on commit ff133ca

Please sign in to comment.
Something went wrong with that request. Please try again.