Blog detail page not pulling in styles

Hi,

I’m new to Middleman and am having trouble getting my blog detail page to pull in the stylesheet. When I click on the blog title (from the blog listing page) and go to the full article it just has unstyled body text. Any help would be much appreciated!

Thanks,
R.S.

I created this layout: article_layout.erb

<% wrap_layout :layout do %>
  <header>My Name</header>
    <body class="no-bg-body">
       <article>
           <%= yield %>
      </article>
    </body>

Here is stylesheet for header & body : all.css.scss

header {
background-color: #5199ce;
color: #fff;
font-family: ‘Raleway’, sans-serif;
font-size: 30px;
height: 60px;
width: 100%;
padding-left: 50px;
padding-top: 10px;
}

body {
font-family: sans-serif;
background: url("…/images/sdbg.jpg");
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

.no-bg-body {
background: url("#");
background-color: #fff;
}

Here is config.rb:

activate :blog do |blog|
blog.layout = "article_layout"
end

page "blog/*", :layout => :article_layout

Sample article:

2015-08-08-sample-article-name.html.erb

--- title: Sample article name date: 2015-08-08 15:50 UTC layout: article_layout

Lorem ipsum dolor sit amet, deseruisse vituperatoribus mea at, timeam delectus corrumpit no duo. Sed mentitum expetenda referrentur ad. Agam feugiat ocurreret et sea, paulo offendit vulputate ut nam.

Hello @rasmm

Welcome the the Middleman world

Here is your fix in your config.rb

blog.layout = "layouts/article_layout"

Cheers

And another protip : Drop this sh$tty vendor prefixes from your styles & use autoprefixer
You can found an example here https://github.com/flexbox/davidl/blob/master/config.rb

Hi @flexbox

Thank you for your reply!

My article_layout.erb file is located in source folder and I never created a special layouts folder. I just created a layouts folder and put the file in and changed the config.rb file to match but nothing changed. I changed it back for the time being.

Maybe there is another issue with my config.rb file?

Hummm

index.html is different to layout.html

You need a layouts/layout.html :smiley:

1 Like