DaveWoodall.com
DaveWoodall.com

Reputation: 797

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.)

Upvotes: 1

Views: 351

Answers (2)

DaveWoodall.com
DaveWoodall.com

Reputation: 797

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

Upvotes: 1

There is no built-in way to override that.

But probably you could find where in Middleman Blog code that file is invoked and override that method from config.rb, having it pointing at a different template file.

Upvotes: 0

Related Questions