diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee
index 9aee3b281f3f78653653d631902c20292607c766..06787ddf874933700fa646a0d78ea54bb3697354 100644
--- a/app/assets/javascripts/dispatcher.js.coffee
+++ b/app/assets/javascripts/dispatcher.js.coffee
@@ -8,7 +8,6 @@ class Dispatcher
 
   initPageScripts: ->
     page = $('body').attr('data-page')
-    project_id = $('body').attr('data-project-id')
 
     unless page
       return false
diff --git a/app/controllers/admin/application_controller.rb b/app/controllers/admin/application_controller.rb
index cfbeb035c0ea1ca0c6a2a975de4aa54f4dfba23a..56e24386463db3a95e794faf0ed9ed83df635336 100644
--- a/app/controllers/admin/application_controller.rb
+++ b/app/controllers/admin/application_controller.rb
@@ -3,15 +3,9 @@
 # Automatically sets the layout and ensures an administrator is logged in
 class Admin::ApplicationController < ApplicationController
   before_action :authenticate_admin!
-  before_action :set_title
+  layout 'admin'
 
   def authenticate_admin!
     return render_404 unless current_user.is_admin?
   end
-
-  def set_title
-    @title      = "Admin area"
-    @title_url  = admin_root_path
-    @sidebar    = "admin"
-  end
 end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 69fd7901832f1f85093e173408b818c34ad176a3..c9b34eac4b081635567be534bb2dbcd38c3f57ad 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -3,6 +3,7 @@ require 'gon'
 class ApplicationController < ActionController::Base
   include Gitlab::CurrentSettings
   include GitlabRoutingHelper
+  include PageLayoutHelper
 
   PER_PAGE = 20
 
diff --git a/app/controllers/dashboard/application_controller.rb b/app/controllers/dashboard/application_controller.rb
index 0a0af3d4ce2a99d346ed5952287de045e35e65e2..962ea38d6c9c01020e2cc888a1b915261032c5af 100644
--- a/app/controllers/dashboard/application_controller.rb
+++ b/app/controllers/dashboard/application_controller.rb
@@ -1,11 +1,3 @@
 class Dashboard::ApplicationController < ApplicationController
-  before_action :set_title
-
-  private
-
-  def set_title
-    @title      = "Dashboard"
-    @title_url  = root_path
-    @sidebar    = "dashboard"
-  end
+  layout 'dashboard'
 end
diff --git a/app/controllers/explore/application_controller.rb b/app/controllers/explore/application_controller.rb
index 8d94fd238a6a20a9ab9fb955c4ba3150a6fa1a34..4b275033d26c76158706ff988d8a9aa4bae5fe2b 100644
--- a/app/controllers/explore/application_controller.rb
+++ b/app/controllers/explore/application_controller.rb
@@ -1,11 +1,3 @@
 class Explore::ApplicationController < ApplicationController
-  before_action :set_title
-
-  private
-
-  def set_title
-    @title      = "Explore GitLab"
-    @title_url  = explore_root_path
-    @sidebar    = "explore"
-  end
+  layout 'explore'
 end
diff --git a/app/controllers/groups/application_controller.rb b/app/controllers/groups/application_controller.rb
index e0fd4befae9abd1ac7466efdfef37477983dbc84..4df9d1b7533c2d229ca4b50d1b9d06664b57ea01 100644
--- a/app/controllers/groups/application_controller.rb
+++ b/app/controllers/groups/application_controller.rb
@@ -1,5 +1,5 @@
 class Groups::ApplicationController < ApplicationController
-  before_action :set_title
+  layout 'group'
 
   private
   
@@ -18,10 +18,4 @@ class Groups::ApplicationController < ApplicationController
       return render_404
     end
   end
-
-  def set_title
-    @title      = group.name
-    @title_url  = group_path(group)
-    @sidebar    = "group"
-  end
 end
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index 66e92abff8d045695fd25a231296eacc17bdb96e..34f0b257db3b48efc784c39e0a4b177b3b5c4450 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -12,6 +12,8 @@ class GroupsController < Groups::ApplicationController
   before_action :load_projects, except: [:new, :create, :projects, :edit, :update]
   before_action :event_filter, only: :show
 
+  layout :determine_layout
+
   def new
     @group = Group.new
   end
@@ -116,11 +118,11 @@ class GroupsController < Groups::ApplicationController
     end
   end
 
-  def set_title
+  def determine_layout
     if [:new, :create].include?(action_name.to_sym)
-      @title = 'New Group'
+      'application'
     else
-      super
+      'group'
     end
   end
 
diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb
index 2842151e3bd02357c7f195f52071bf48110d228a..8a45dc8860d15f20b40299edd95e90186fc482f7 100644
--- a/app/controllers/help_controller.rb
+++ b/app/controllers/help_controller.rb
@@ -1,5 +1,5 @@
 class HelpController < ApplicationController
-  before_action :set_title
+  layout 'help'
 
   def index
   end
@@ -46,11 +46,6 @@ class HelpController < ApplicationController
 
   private
 
-  def set_title
-    @title      = "Help"
-    @title_url  = help_path
-  end
-
   def path_params
     params.require(:category)
     params.require(:file)
diff --git a/app/controllers/oauth/applications_controller.rb b/app/controllers/oauth/applications_controller.rb
index f30a85564d448954b1b68ec72ffefd736213a3db..507b8290a2b079861eb0143719dcbcd683908a3c 100644
--- a/app/controllers/oauth/applications_controller.rb
+++ b/app/controllers/oauth/applications_controller.rb
@@ -1,6 +1,9 @@
 class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
+  include PageLayoutHelper
+  
   before_action :authenticate_user!
-  before_action :set_title
+
+  layout 'profile'
 
   def index
     head :forbidden and return
@@ -36,10 +39,4 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
   rescue_from ActiveRecord::RecordNotFound do |exception|
     render "errors/not_found", layout: "errors", status: 404
   end
-
-  def set_title
-    @title      = "Profile"
-    @title_url  = profile_path
-    @sidebar    = "profile"
-  end
 end
diff --git a/app/controllers/oauth/authorizations_controller.rb b/app/controllers/oauth/authorizations_controller.rb
index c62890ba85b86a9c65b646c14552e2a7d6ffc88a..24025d8c723f27146a4676685071024e19029903 100644
--- a/app/controllers/oauth/authorizations_controller.rb
+++ b/app/controllers/oauth/authorizations_controller.rb
@@ -1,6 +1,7 @@
 class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
   before_action :authenticate_resource_owner!
-  before_action :set_title
+
+  layout 'profile'
 
   def new
     if pre_auth.authorizable?
@@ -54,10 +55,4 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
   def strategy
     @strategy ||= server.authorization_request(pre_auth.response_type)
   end
-  
-  def set_title
-    @title      = "Profile"
-    @title_url  = profile_path
-    @sidebar    = "profile"
-  end
 end
diff --git a/app/controllers/oauth/authorized_applications_controller.rb b/app/controllers/oauth/authorized_applications_controller.rb
index 63c634f376bed945a6c8fff96d7c462328030f38..3ab6def511c8b3ca54c3d1c70b32c2ad09a89495 100644
--- a/app/controllers/oauth/authorized_applications_controller.rb
+++ b/app/controllers/oauth/authorized_applications_controller.rb
@@ -1,16 +1,10 @@
 class Oauth::AuthorizedApplicationsController < Doorkeeper::AuthorizedApplicationsController
-  before_action :set_title
+  include PageLayoutHelper
+
+  layout 'profile'
 
   def destroy
     Doorkeeper::AccessToken.revoke_all_for(params[:id], current_resource_owner)
     redirect_to applications_profile_url, notice: I18n.t(:notice, scope: [:doorkeeper, :flash, :authorized_applications, :destroy])
   end
-
-  private
-  
-  def set_title
-    @title      = "Profile"
-    @title_url  = profile_path
-    @sidebar    = "profile"
-  end
 end
diff --git a/app/controllers/profiles/application_controller.rb b/app/controllers/profiles/application_controller.rb
index 8373ff7a758acf6b47c65d777ef5ea42f122baa1..c8be288b9a077ec86c880496a5640baa82ffb5b5 100644
--- a/app/controllers/profiles/application_controller.rb
+++ b/app/controllers/profiles/application_controller.rb
@@ -1,11 +1,3 @@
 class Profiles::ApplicationController < ApplicationController
-  before_action :set_title
-
-  private
-
-  def set_title
-    @title      = "Profile"
-    @title_url  = profile_path
-    @sidebar    = "profile"
-  end
+  layout 'profile'
 end
diff --git a/app/controllers/profiles/passwords_controller.rb b/app/controllers/profiles/passwords_controller.rb
index 86976ae39e3c80ad8268564807ea4b1bc004e8ce..c780e0983f93ae07443138cb2a42ef95828a767b 100644
--- a/app/controllers/profiles/passwords_controller.rb
+++ b/app/controllers/profiles/passwords_controller.rb
@@ -2,9 +2,10 @@ class Profiles::PasswordsController < Profiles::ApplicationController
   skip_before_action :check_password_expiration, only: [:new, :create]
 
   before_action :set_user
-  before_action :set_title
   before_action :authorize_change_password!
 
+  layout :determine_layout
+
   def new
   end
 
@@ -64,11 +65,11 @@ class Profiles::PasswordsController < Profiles::ApplicationController
     @user = current_user
   end
 
-  def set_title
+  def determine_layout
     if [:new, :create].include?(action_name.to_sym)
-      @title = "New password"
+      'application'
     else
-      super
+      'profile'
     end
   end
 
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index da6b0c3c91aea22cb87da00ae94de4cfe1cc4350..dc4303515510a7767e8ba219ae7db53eedf88e4f 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -6,7 +6,6 @@ class ProjectsController < ApplicationController
 
   # Authorize
   before_action :authorize_admin_project!, only: [:edit, :update, :destroy, :transfer, :archive, :unarchive]
-  before_action :set_title, only: [:new, :create]
   before_action :event_filter, only: :show
 
   layout :determine_layout
@@ -160,10 +159,6 @@ class ProjectsController < ApplicationController
 
   private
 
-  def set_title
-    @title = 'New Project'
-  end
-
   def determine_layout
     if [:new, :create].include?(action_name.to_sym)
       'application'
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb
index ba6f2a41fdce1fa1d6100388fd17ae9114a4222e..4e2ea6c5710ff14cca8c75d7f5f764d7b3410cc3 100644
--- a/app/controllers/search_controller.rb
+++ b/app/controllers/search_controller.rb
@@ -1,7 +1,7 @@
 class SearchController < ApplicationController
   include SearchHelper
 
-  before_action :set_title
+  layout 'search'
 
   def show
     return if params[:search].nil? || params[:search].blank?
@@ -57,11 +57,4 @@ class SearchController < ApplicationController
 
     render json: search_autocomplete_opts(term).to_json
   end
-
-  private
-
-  def set_title
-    @title      = "Search"
-    @title_url  = search_path
-  end
 end
diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb
index c960724b47a26e48febdf5a8a0b55da1cc94c1bb..cf672c5c0932b05b8a34d20aaed6e8a09460c98f 100644
--- a/app/controllers/snippets_controller.rb
+++ b/app/controllers/snippets_controller.rb
@@ -7,10 +7,9 @@ class SnippetsController < ApplicationController
   # Allow destroy snippet
   before_action :authorize_admin_snippet!, only: [:destroy]
 
-  before_action :set_title
-
   skip_before_action :authenticate_user!, only: [:index, :user_index, :show, :raw]
 
+  layout 'snippets'
   respond_to :html
 
   def index
@@ -96,12 +95,6 @@ class SnippetsController < ApplicationController
     return render_404 unless can?(current_user, :admin_personal_snippet, @snippet)
   end
 
-  def set_title
-    @title      = 'Snippets'
-    @title_url  = snippets_path
-    @sidebar    = "snippets"
-  end
-
   def snippet_params
     params.require(:personal_snippet).permit(:title, :content, :file_name, :private, :visibility_level)
   end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 399e49e352dd1d4b354b583456629d24f6702f86..6e86400a4f6e4c3bd9a5d4db8bf3508b5a01688a 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -332,12 +332,4 @@ module ApplicationHelper
       end
     "#{entity_title}#{count}"
   end
-
-  def page_title(*titles)
-    @page_title ||= []
-
-    @page_title.push(*titles.compact) if titles.any?
-
-    @page_title.join(" | ")
-  end
 end
diff --git a/app/helpers/page_layout_helper.rb b/app/helpers/page_layout_helper.rb
new file mode 100644
index 0000000000000000000000000000000000000000..01b6a63552c1c00123becdcc5a98c19ee9e7374b
--- /dev/null
+++ b/app/helpers/page_layout_helper.rb
@@ -0,0 +1,26 @@
+module PageLayoutHelper
+  def page_title(*titles)
+    @page_title ||= []
+
+    @page_title.push(*titles.compact) if titles.any?
+
+    @page_title.join(" | ")
+  end
+
+  def header_title(title = nil, title_url = nil)
+    if title
+      @header_title     = title
+      @header_title_url = title_url
+    else
+      @header_title_url ? link_to(@header_title, @header_title_url) : @header_title
+    end
+  end
+
+  def sidebar(name = nil)
+    if name
+      @sidebar = name
+    else
+      @sidebar
+    end
+  end
+end
diff --git a/app/views/groups/new.html.haml b/app/views/groups/new.html.haml
index 6e17cdaef6f9c9a1870b74c592e2e359b976c607..edb882bea19a24deef769ffee0d59a48f67e6ef2 100644
--- a/app/views/groups/new.html.haml
+++ b/app/views/groups/new.html.haml
@@ -1,3 +1,5 @@
+- page_title    'New Group'
+- header_title  'New Group'
 = form_for @group, html: { class: 'group-form form-horizontal' } do |f|
   - if @group.errors.any?
     .alert.alert-danger
diff --git a/app/views/layouts/admin.html.haml b/app/views/layouts/admin.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..1c738719bd84b3782c7e0cd60aa88a4c2cea6cbf
--- /dev/null
+++ b/app/views/layouts/admin.html.haml
@@ -0,0 +1,5 @@
+- page_title    "Admin area"
+- header_title  "Admin area", admin_root_path
+- sidebar       "admin"
+
+= render template: "layouts/application"
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index e0829d40bc42254f5ca19c198af40311ae070b61..a97feeb1ecdc9caf4afc63eb2321d5eaadfd3c8b 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -1,13 +1,10 @@
-- page_title @title
 !!! 5
 %html{ lang: "en"}
   = render "layouts/head"
-  %body{class: "#{app_theme}  application", :'data-page' => body_data_page}
-    - title = defined?(@title_url) ? link_to(@title, @title_url) : @title
-
+  %body{class: "#{app_theme}", :'data-page' => body_data_page}
     - if current_user
-      = render "layouts/head_panel", title: title
+      = render "layouts/head_panel", title: header_title
     - else
-      = render "layouts/public_head_panel", title: title
+      = render "layouts/public_head_panel", title: header_title
 
-    = render 'layouts/page', sidebar: @sidebar
+    = render 'layouts/page', sidebar: sidebar
diff --git a/app/views/layouts/dashboard.html.haml b/app/views/layouts/dashboard.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..c72eca10bf4c379635b91a52a85a48a2e0a8a4b7
--- /dev/null
+++ b/app/views/layouts/dashboard.html.haml
@@ -0,0 +1,5 @@
+- page_title    "Dashboard"
+- header_title  "Dashboard", root_path
+- sidebar       "dashboard"
+
+= render template: "layouts/application"
diff --git a/app/views/layouts/explore.html.haml b/app/views/layouts/explore.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..56bb92a536edbb41d2b4d2fc295a14d92d3f5d3b
--- /dev/null
+++ b/app/views/layouts/explore.html.haml
@@ -0,0 +1,5 @@
+- page_title    "Explore"
+- header_title  "Explore GitLab", explore_root_path
+- sidebar       "explore"
+
+= render template: "layouts/application"
diff --git a/app/views/layouts/group.html.haml b/app/views/layouts/group.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..5edc03129d233d0c77bdea85f2b477ec607c1233
--- /dev/null
+++ b/app/views/layouts/group.html.haml
@@ -0,0 +1,5 @@
+- page_title    @group.name
+- header_title  @group.name, group_path(@group)
+- sidebar       "group"
+
+= render template: "layouts/application"
diff --git a/app/views/layouts/help.html.haml b/app/views/layouts/help.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..224b24befbe8724f7b0af25a4e752c08ad654467
--- /dev/null
+++ b/app/views/layouts/help.html.haml
@@ -0,0 +1,4 @@
+- page_title    "Help"
+- header_title  "Help", help_path
+
+= render template: "layouts/application"
diff --git a/app/views/layouts/profile.html.haml b/app/views/layouts/profile.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..9799b4cc4d72c4f31d08dcf51ea499664097e3fd
--- /dev/null
+++ b/app/views/layouts/profile.html.haml
@@ -0,0 +1,5 @@
+- page_title    "Profile"
+- header_title  "Profile", profile_path
+- sidebar       "profile"
+
+= render template: "layouts/application"
diff --git a/app/views/layouts/project.html.haml b/app/views/layouts/project.html.haml
index 62a6f5ddf4dcc8c44ad110aef73ea72dce993c42..4aeb9d397d2aa73a504077a6e3d2dc21eb241660 100644
--- a/app/views/layouts/project.html.haml
+++ b/app/views/layouts/project.html.haml
@@ -1,14 +1,8 @@
-- page_title @project.name_with_namespace
-!!! 5
-%html{ lang: "en"}
-  = render "layouts/head"
-  %body{class: "#{app_theme}  project", :'data-page' => body_data_page, :'data-project-id' => @project.id }
-    - title = project_title(@project)
+- page_title    @project.name_with_namespace
+- header_title  project_title(@project)
+- sidebar       "project" unless sidebar
 
-    - if current_user
-      = render "layouts/head_panel", title: project_title(@project)
-      = render "layouts/init_auto_complete"
-    - else
-      = render "layouts/public_head_panel", title: project_title(@project)
-      
-    = render 'layouts/page', sidebar: @sidebar || 'project'
+- content_for :embedded_scripts do
+  = render "layouts/init_auto_complete" if current_user
+
+= render template: "layouts/application"
diff --git a/app/views/layouts/project_settings.html.haml b/app/views/layouts/project_settings.html.haml
index d12d07273f3f45345e0a1520997b064fece9976a..4340166833487461454281ad4759f490380165c1 100644
--- a/app/views/layouts/project_settings.html.haml
+++ b/app/views/layouts/project_settings.html.haml
@@ -1,2 +1,4 @@
-- @sidebar = "project_settings"
+- page_title  "Settings"
+- sidebar     "project_settings"
+
 = render template: "layouts/project"
diff --git a/app/views/layouts/search.html.haml b/app/views/layouts/search.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..fd4c7ad21a71501bc03cf01dffb42e56ce38305d
--- /dev/null
+++ b/app/views/layouts/search.html.haml
@@ -0,0 +1,4 @@
+- page_title    "Search"
+- header_title  "Search", search_path
+
+= render template: "layouts/application"
diff --git a/app/views/layouts/snippets.html.haml b/app/views/layouts/snippets.html.haml
new file mode 100644
index 0000000000000000000000000000000000000000..9b0f40073ab79061cc7da12c3ff391377ffc6fa0
--- /dev/null
+++ b/app/views/layouts/snippets.html.haml
@@ -0,0 +1,5 @@
+- page_title    'Snippets'
+- header_title  'Snippets', snippets_path
+- sidebar       "snippets"
+
+= render template: "layouts/application"
diff --git a/app/views/profiles/passwords/new.html.haml b/app/views/profiles/passwords/new.html.haml
index 8bed6e0dbee1f4fcd1e21fd1c3a654a5402324e5..9c6204963e00fd81903fb8603cc55097cda3e012 100644
--- a/app/views/profiles/passwords/new.html.haml
+++ b/app/views/profiles/passwords/new.html.haml
@@ -1,3 +1,5 @@
+- page_title    "New Password"
+- header_title  "New Password"
 %h3.page-title Setup new password
 %hr
 = form_for @user, url: profile_password_path, method: :post, html: { class: 'form-horizontal '} do |f|
diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml
index 1fe6a24e89f941e8582d4afc66d082cc4f154547..c09d794ef7f48619e55d97bb636acfc38d9dad15 100644
--- a/app/views/projects/edit.html.haml
+++ b/app/views/projects/edit.html.haml
@@ -1,4 +1,3 @@
-- page_title "Settings"
 .project-edit-container
   .project-edit-errors
   .project-edit-content
diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml
index 47c69f89a97888c6ee3dde97a3977c9e868de584..e56d8615132f256c4ddd806b06d6bea6d7c12e64 100644
--- a/app/views/projects/new.html.haml
+++ b/app/views/projects/new.html.haml
@@ -1,3 +1,5 @@
+- page_title    'New Project'
+- header_title  'New Project'
 .project-edit-container
   .project-edit-errors
     = render 'projects/errors'