Can't get my article loop working

Hi all,

I’ve spent the past two days googling, so I’m submitting a call for help! I’m not returning any errors when running middleman, so it’s been tough to troubleshoot. It renders out my discovery partial, but then nothing. Articles count is returning 0.

Here’s the code for index.html.haml:


title: XD Framework

.wrapper
%h1 Discovery Phase
.phase-description
= partial ‘partials/discovery.md’

	- blog("discovery").articles.each do |topic|
		%article.project.list-item
		%h2.list-item-title= link_to topic.title, topic.url
		%h4.list-item-intro= topic.metadata[:page]['intro']

	= blog("discovery").articles.count

and my config.rb:

activate :blog do |discovery|
  # set options on blog
  discovery.name = "discovery"
  discovery.prefix = "discovery"
  discovery.layout = "phase_layout"
  discovery.permalink = "/{title}.html"
  discovery.sources = "/{title}.html"
  discovery.default_extension = ".md"
end

Any/all ideas welcome. Thank you!

Where are you putting your blog posts?

a folder in source:

source/discovery/*.md

What happens if you add = blog("discovery") in your partial to debug? What does it show then?

it renders a # sign on the page

I think your problem is you are calling your articles test.md instead of test.html.md. If you want to have them be test.md you have to change

discovery.sources = "/{title}.html"

to


discovery.sources = "/{title}"

added in .html to the file extension which looks like it’s reading the folder now!

thanks very much for clearing this up! :grinning: