Update config styles

This commit is contained in:
Seth Vargo 2017-03-28 16:21:43 -04:00
parent 297081158f
commit f5a10460dd
No known key found for this signature in database
GPG Key ID: C921994F9C27E0FF
1 changed files with 21 additions and 1 deletions

View File

@ -55,6 +55,15 @@ helpers do
if page.url == "/" || page.url == "/index.html"
return "page-home"
end
if !(title = page.data.page_title).blank?
return title
.downcase
.gsub('"', '')
.gsub(/[^\w]+/, '-')
.gsub(/_+/, '-')
.squeeze('-')
.squeeze(' ')
end
return ""
end
@ -63,10 +72,21 @@ helpers do
def body_classes_for(page)
classes = []
if page && page.data.layout
if !(layout = page.data.layout).blank?
classes << "layout-#{page.data.layout}"
end
if !(title = page.data.page_title).blank?
title = title
.downcase
.gsub('"', '')
.gsub(/[^\w]+/, '-')
.gsub(/_+/, '-')
.squeeze('-')
.squeeze(' ')
classes << "page-#{title}"
end
return classes.join(" ")
end
end