Frontmatter will not render

Hello. I’ve been using Middleman for a long time now. Recently we started building a new project using Middleman 4 for the first time, and for some reason I absolutely cannot get Frontmatter to render. Nothing I try seems to work. I’m tempted to submit a github issue, but I wanted to post here first.

I have a basic index.html.erb file straight from the Middleman docs:

---
layout: "custom"
title: "My Title"
my_list:
  - one
  - two
  - three
---

<h1>List</h1>
<ol>
  <% current_page.data.my_list.each do |f| %>
  <li><%= f %></li>
  <% end %>
</ol>

And I’m getting the typical:

NoMethodError at /
undefined method `each' for nil:NilClass

If I remove layout and my_list and just have a title like so - title: "Hello World" with a corresponding tag in the body <%= current_page.data.title %> the tag renders as empty. Any help is greatly appreciated.

This is my Gemfile:

source 'https://rubygems.org'

gem 'middleman', '>= 4.0.0'
gem 'middleman-livereload'
gem 'middleman-blog'
gem 'middleman-autoprefixer'
gem "contentful_middleman", git: 'git@github.com:contentful/contentful_middleman.git', branch: 'dl/upgrade-to-v4'

I had sort of similar issues recently. Try to update all your gems and update the bundle. That did work for me.