Created
August 21, 2015 14:57
-
-
Save dkhgh/def45c066722e48caa90 to your computer and use it in GitHub Desktop.
I18n titles with frontmatter in Middleman
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: | |
en: About Us | |
nl: Over ons | |
de: Ueber Uns | |
--- | |
<div>HTML STUFF</div> | |
<%= partial "about-us/team" %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#use frontmatter for I18n titles | |
def page_title(page) | |
if page.data.title.is_a?(Hash) && page.data.title[I18n.locale] | |
return "#{page.data.title.send(I18n.locale)} - MyCompany" | |
elsif page.data.title | |
return "#{page.data.title} - MyCompany" | |
else | |
return "MyCompany - Our Slogan" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment