From 4fa11f159f5dd77b3f8ba9049b84248c6b987d14 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Wed, 11 Sep 2013 15:33:05 -0400 Subject: [PATCH] Add site setting site_description. If filled, it will be used in meta description tag for teh white hat SEO --- app/controllers/categories_controller.rb | 2 ++ app/controllers/list_controller.rb | 1 + app/models/site_setting.rb | 1 + config/locales/server.en.yml | 1 + 4 files changed, 5 insertions(+) diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb index 4684c845e2e..c7487f13d11 100644 --- a/app/controllers/categories_controller.rb +++ b/app/controllers/categories_controller.rb @@ -7,6 +7,8 @@ class CategoriesController < ApplicationController skip_before_filter :check_xhr, only: [:index] def index + @description = SiteSetting.site_description + @list = CategoryList.new(guardian) @list.draft_key = Draft::NEW_TOPIC diff --git a/app/controllers/list_controller.rb b/app/controllers/list_controller.rb index 4d36b17fc9c..ea6e6a8dc9e 100644 --- a/app/controllers/list_controller.rb +++ b/app/controllers/list_controller.rb @@ -11,6 +11,7 @@ class ListController < ApplicationController user = list_target_user list = TopicQuery.new(user, list_opts).public_send("list_#{filter}") list.more_topics_url = url_for(self.public_send "#{filter}_path".to_sym, list_opts.merge(format: 'json', page: next_page)) + @description = SiteSetting.site_description if [:latest, :hot].include?(filter) respond(list) end diff --git a/app/models/site_setting.rb b/app/models/site_setting.rb index 6ceb9291f19..b362117ccfc 100644 --- a/app/models/site_setting.rb +++ b/app/models/site_setting.rb @@ -8,6 +8,7 @@ class SiteSetting < ActiveRecord::Base # settings available in javascript under Discourse.SiteSettings client_setting(:title, "Discourse") + setting(:site_description, '') client_setting(:logo_url, '/assets/d-logo-sketch.png') client_setting(:logo_small_url, '/assets/d-logo-sketch-small.png') setting(:contact_email, '') diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 5f5d324f851..0e1982cc115 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -459,6 +459,7 @@ en: discourse_org_access_key: "The access key used to access the Discourse Hub nickname registry at discourse.org" educate_until_posts: "Show pop-up composer education panel until the user has made this many posts" title: "Title of this site, will be used in the title tag and elsewhere" + site_description: "Describe this forum in one sentence. This description will be used in the meta description tag." contact_email: "The email address of someone who can be contacted about the site. Important notices from Discourse.org regarding critical updates may be sent to this address." company_full_name: "The full name of the company that runs this site, used in legal documents like the /tos" company_short_name: "The short name of the company that runs this site, used in legal documents like the /tos"