Skip to content

Commit

Permalink
fix issue #45: Localization and page meta_description
Browse files Browse the repository at this point in the history
  • Loading branch information
did committed Nov 28, 2015
1 parent d099873 commit f005060
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/locomotive/steam/adapters/filesystem/yaml_loaders/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,19 @@ def build(filepath, fullpath, locale)
slug = fullpath.split('/').last
attributes = get_attributes(filepath, fullpath)

{
_attributes = {
title: { locale => attributes.delete(:title) || (default_locale == locale ? slug.humanize : nil) },
slug: { locale => attributes.delete(:slug) || slug.dasherize },
template_path: { locale => template_path(filepath, attributes, locale) },
redirect_url: { locale => attributes.delete(:redirect_url) },
editable_elements: build_editable_elements(attributes.delete(:editable_elements), locale),
_fullpath: fullpath
}.merge(attributes)
}

[:redirect_url, :seo_title, :meta_description, :meta_keywords].each do |name|
_attributes[name] = { locale => attributes.delete(name) }
end

_attributes.merge!(attributes)
end

def update(leaf, filepath, fullpath, locale)
Expand All @@ -59,7 +64,10 @@ def update(leaf, filepath, fullpath, locale)
leaf[:title][locale] = attributes.delete(:title) || slug.humanize
leaf[:slug][locale] = attributes.delete(:slug) || slug.dasherize
leaf[:template_path][locale] = template_path(filepath, attributes, locale)
leaf[:redirect_url][locale] = attributes.delete(:redirect_url)

[:redirect_url, :seo_title, :meta_description, :meta_keywords].each do |name|
leaf[name][locale] = attributes.delete(name)
end

update_editable_elements(leaf, attributes.delete(:editable_elements), locale)

Expand Down

0 comments on commit f005060

Please sign in to comment.