AFAIK there is no solution for that, unfortunately. The less elegant workaround/solution is to set the metadata in the page code, after frontmatter. This is described here: Generate extra data for resources . I remember there was some confusion about when to use metadata
and when data
– some of this is read-only AFAIR, in case of problems google this forum for more info.
But I think in most cases you can avoid the need to use variables in frontmatter. Where I need them mostly is to dynamically set the page title and other HTML-metadata, but instead fighting with Middleman’s metadata I just use a capture helper.
In my layout.erb
I have:
<html>
<head>
<% if content_for?(:head_assets) %>
<%= yield_content :head_assets %>
<% else %>
<title><%= current_page.data.title %></title>
<%= feed_tag :atom, "#{blog.options.prefix.to_s}/feed.xml", title: "Atom Feed" %>
<meta name="description" content="<%= data.project_config.site_description %>" />
<meta property="og:title" content="<%= current_page.data.title %>" />
<meta property="og:description" content="<%= data.project_config.site_description %>" />
<% end %>
and some of my pages use static title, some create it dynamically:
<% content_for :head_assets do %>
…
<% end %>
Where would values of @month
come from?