Skip to content

Instantly share code, notes, and snippets.

@dkhgh
Created August 21, 2015 14:57
Show Gist options
  • Save dkhgh/def45c066722e48caa90 to your computer and use it in GitHub Desktop.
Save dkhgh/def45c066722e48caa90 to your computer and use it in GitHub Desktop.
I18n titles with frontmatter in Middleman
---
title:
en: About Us
nl: Over ons
de: Ueber Uns
---
<div>HTML STUFF</div>
<%= partial "about-us/team" %>
#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