Open mtrolle opened 9 years ago
A very simple solution for this request is to paste the following code to your ApplicationController
before_filter :read_meta_tags_from_locales
def read_meta_tags_from_locales
name_space = "meta_tags.#{controller_name}.#{action_name}"
@page_title = I18n.t("#{name_space}.title") unless I18n.t("#{name_space}.title", default: '').blank?
@page_description = I18n.t("#{name_space}.description") unless I18n.t("#{name_space}.description", default: '').blank?
@page_keywords = I18n.t("#{name_space}.keywords") unless I18n.t("#{name_space}.keywords", default: '').blank?
end
protected :read_meta_tags_from_locales
This will support the locales structure given above for title
, description
and keywords
.
Has it been considered to add ability to add meta tags using i18n locale files?
E.g. in a namespace like:
etc. ?