Search code examples
middleman

How to override blog template generator (article.tt) in Middleman Blog Gem?


The middleman blog gem creates new articles based on lib/middleman-blog/commands/article.tt Current format is is;

---
title: <%= @title %>
date: <%= @date.strftime('%F %R %Z') %>
tags:
---

What is the best way to override that if I wanted default front matter to be something else like;

---
layout: blog
author: Dave
---

(Other than opening the gem and changing it there.)


Solution

  • Solved it by adding blog.new_article_template to blog settings in config.rb like so

    activate :blog do |blog|
      blog.prefix = 'blog' 
      blog.new_article_template = 'source/blog/template.erb'
    end