Skip to content

Commit

Permalink
locals working, but long-winded
Browse files Browse the repository at this point in the history
  • Loading branch information
Perry Kibler committed Jul 2, 2016
1 parent 83ab0b6 commit 43a905c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
7 changes: 6 additions & 1 deletion config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@

if Dir.exist?(config.data_dir)
data.playground.blogPost.each do |id, blogPost|
proxy "post/#{ blogPost.slug }", "post/template.html", :ignore => true, layout: 'layout'
proxy "post/#{ blogPost.slug }", "post/template.html", :ignore => true, layout: 'layout',
:locals => {
:title => blogPost.title,
:body => blogPost.body,
:heroImage => blogPost.heroImage,
}
end
end
# page "/post/#{blogPost[1][:slug]}.html"
Expand Down
11 changes: 5 additions & 6 deletions source/post/template.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ title: Welcome to Middleman
section.contentful-sample
article
h1 Single Post
- data.playground.blogPost.each do |id, blogPost|
h2= blogPost.title
- if blogPost.heroImage
img src="#{ blogPost.heroImage.url }?w=900"
= Kramdown::Document.new(blogPost.body).to_html
hr
h2= title
- if heroImage
img src="#{ heroImage.url }?w=900"
= Kramdown::Document.new(body).to_html
hr

0 comments on commit 43a905c

Please sign in to comment.