middleman / middleman-blog

Blog Engine Extension for Middleman
https://middlemanapp.com
MIT License
325 stars 179 forks source link

Not detecting blog articles #246

Closed Naatan closed 9 years ago

Naatan commented 9 years ago

I'm transferring a site from docpad to middleman, currently stuck at getting middleman-blog to work.

My config: https://github.com/Komodo/komodo-website/blob/middleman/config.rb#L4

Note some articles have titles that do not match the filenames, but a lot of them do. I'd imagine it should pick those up as needed.

Did I forget something here? Am I doing something wrong?

Edit: To clarify - this page remains completely empty: https://github.com/Komodo/komodo-website/blob/middleman/source/blog.html.erb

Dumping "page_articles" returns []

And the actual blog articles do not reflect the blog.permalink setting.

ndorfin commented 9 years ago

Hey @Naatan Two things you can try:

  1. What do your blog article filenames look like? When using middleman-blog for the first time, I noticed that the file extension setting needs to be explicit. i.e. .md won't match on files that have e.g. a .md.erb extension.
  2. Have you got YAML front-matter in each of your articles? Try adding the YAML block to one your article files
Naatan commented 9 years ago
  1. Most of them have an extension of .html.md, you can see them here: https://github.com/Komodo/komodo-website/tree/middleman/source/blog
  2. All files have YAML front matter. I can view the articles through middleman but they do not seem to be interpreted by middleman-blog.

Thanks for your response!

ndorfin commented 9 years ago

Try the following in your config.rb:

blog.default_extension = ".html.md"

Naatan commented 9 years ago

No dice

tdreyno commented 9 years ago

Hmm, can you try putting the articles loop in the main template file rather than a partial?

Naatan commented 9 years ago

I have tried that, but it did nothing.

Is there some way I can debug this?

tdreyno commented 9 years ago

Ah, I see it. Sorry.

Because you set a prefix in config to blog, you don't need to also add it to the sources value. Doing do makes the source path look something like: prefix + source = 'blog/blog/{year}-...

Remove the blog/ prefix on your sources value.

Naatan commented 9 years ago

Thanks @tdreyno - that did it! :)