Accessing current article's frontmatter/metadata data

Hey folks, I’ve been having a hard time using the current_article helper in a layout file. Code in question is https://github.com/fayimora/website/blob/master/source/blog/article.erb

I inspected the hash and as you can see from the block below, it contains everything you’d expect.

<Middleman::Blog::BlogArticle: {"title"=>"Hello World, Welcome To My Blog!!!", "date"=>"18-01-2014 00:30 UTC", "author"=>"Fa
yimora Femi-Balogun", "tags"=>"welcome, introduction, hello world"}>

Screenshot can be found here https://dl.dropboxusercontent.com/u/15079640/misc/Screenshot%202014-01-18%2020.20.42.png

However, there are two problems.

  1. After building the site, I get an error saying “undefined method date for nil:NilClass”. The weird thing is it still works anyways. So if current_article is nil, how can I still access the date? The line in question is this and here is a screenshot of the error.
    https://dl.dropboxusercontent.com/u/15079640/misc/Screenshot%202014-01-18%2020.27.04.png

  2. To access the article’s author, I have to use current_article.data.author. I tried current_article.author but got an error saying author is an undefined method.

I’d really appreciate any help I can get with this.

Cheers