diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb
index 16ea5b2..279067f 100644
--- a/app/controllers/forums_controller.rb
+++ b/app/controllers/forums_controller.rb
@@ -1,7 +1,13 @@
class ForumsController < ApplicationController
before_filter :check_permission, only: [:show, :edit, :update, :destroy]
+
+ def robots
+ respond_to :text
+ end
+end
+
def index
@groups = Forumgroup.select {|g| g.can_view?(current_user) }
@groups.sort_by!{ |g| g.position || 0 }
diff --git a/app/controllers/sitemaps_controller.rb b/app/controllers/sitemaps_controller.rb
new file mode 100644
index 0000000..bde01c8
--- /dev/null
+++ b/app/controllers/sitemaps_controller.rb
@@ -0,0 +1,16 @@
+class SitemapsController < ApplicationController
+
+ layout :false
+ before_action :init_sitemap
+
+ def index
+ @forums = Forum.all
+ end
+
+ private
+
+ def init_sitemap
+ headers['Content-Type'] = 'application/xml'
+ end
+
+end
diff --git a/app/helpers/meta_tags_helper.rb b/app/helpers/meta_tags_helper.rb
new file mode 100644
index 0000000..62cc4eb
--- /dev/null
+++ b/app/helpers/meta_tags_helper.rb
@@ -0,0 +1,14 @@
+module MetaTagsHelper
+ def meta_title
+ content_for?(:meta_title) ? content_for(:meta_title) : DEFAULT_META["meta_title"]
+ end
+
+ def meta_description
+ content_for?(:meta_description) ? content_for(:meta_description) : DEFAULT_META["meta_description"]
+ end
+
+ def meta_image
+ meta_image = (content_for?(:meta_image) ? content_for(:meta_image) : DEFAULT_META["meta_image"])
+ meta_image.starts_with?("http") ? meta_image : image_url(meta_image)
+ end
+end
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index def05b3..05b1b45 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -2,8 +2,28 @@
<%= yield(:site_title).present? ? "#{yield(:site_title)} – " : "" %>Redstoner
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<%= stylesheet_link_tag "application", :media => "all" %>
<% if current_user.try(:dark) == true %>
<%= stylesheet_link_tag "dark", :media => "all" %>
diff --git a/app/views/sitemaps/index.xml.builder b/app/views/sitemaps/index.xml.builder
new file mode 100644
index 0000000..223fbb2
--- /dev/null
+++ b/app/views/sitemaps/index.xml.builder
@@ -0,0 +1,19 @@
+xml.instruct! :xml, version: '1.0'
+xml.tag! 'sitemapindex', 'xmlns' => "http://www.sitemaps.org/schemas/sitemap/0.9" do
+
+ xml.tag! 'url' do
+ xml.tag! 'loc', root_url
+ end
+
+ xml.tag! 'url' do
+ xml.tag! 'loc', contact_url
+ end
+
+ @posts.each do |post|
+ xml.tag! 'url' do
+ xml.tag! 'loc', post_url(post)
+ xml.lastmod post.updated_at.strftime("%F")
+ end
+ end
+
+end
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 338dd3f..3c4a74e 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -32,7 +32,7 @@ Redstoner::Application.configure do
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
- # config.force_ssl = true
+ config.force_ssl = true
# See everything in the log (default is :info)
config.log_level = :info
diff --git a/config/initializers/default_meta.rb b/config/initializers/default_meta.rb
new file mode 100644
index 0000000..356f385
--- /dev/null
+++ b/config/initializers/default_meta.rb
@@ -0,0 +1 @@
+DEFAULT_META = YAML.load_file(Rails.root.join("config/meta.yml"))
diff --git a/config/meta.yml b/config/meta.yml
new file mode 100644
index 0000000..ea8b84f
--- /dev/null
+++ b/config/meta.yml
@@ -0,0 +1,4 @@
+meta_title: "Redstoner Server"
+meta_description: " Redstoner is an amazing minecraft server for all redstoners of any (or no) skill level, beginner to advanced, from combo locks to doors to CPUs!"
+meta_image: "https://redstoner.com/assets/logo-91dbce98be157baa7fe6aa1baad7e0e2a01cd8f997bbe9fe160653dc46754ce3.svg"
+twitter_account: "@RedstonerServer"
diff --git a/config/routes.rb b/config/routes.rb
index 6ad277b..4c2a822 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -59,3 +59,13 @@ Redstoner::Application.routes.draw do
root to: 'statics#index'
end
+
+get '/sitemap.xml' => 'sitemaps#index', defaults: { format: 'xml' }
+
+get "/robots.:format", to: "pages#robots"
+
+constraints(host: /^(?!www\.)/i) do
+ match '(*any)' => redirect { |params, request|
+ URI.parse(request.url).tap { |uri| uri.host = "www.#{uri.host}" }.to_s
+ }
+end
diff --git a/public/robots.txt b/public/robots.txt
index 8c507d8..7b24b92 100644
--- a/public/robots.txt
+++ b/public/robots.txt
@@ -56,4 +56,6 @@ Disallow: /harm/to/self
Crawl-delay: 10
# People don't like being stalked ;)
-Disallow: /users
\ No newline at end of file
+Disallow: /users
+
+Sitemap: https://redstoner.com/sitemap.xml