Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Middleman build fails when "Middleman article" is used to create article (Timestamp mismatch) #94

debajit opened this issue Jan 14, 2013 · 8 comments


Copy link

debajit commented Jan 14, 2013

Steps to Reproduce:
• Create a blog article using "middleman article title"
• Run middleman build

Expected Results:
The build should not fail.

Actual Results:
The build fails.

This is because the markdown filename contains only the date, whereas the frontmatter contains the time as well.
date: 2006-06-10 00:00 +00:00

Copy link

erikthered commented Jan 15, 2013

You need to set the timezone in your config.rb. For example: = "US/Eastern"

This happens because Middleman assumes UTC by default, which is not the case if you're on Windows or something else using localtime.

Copy link

debajit commented Jan 15, 2013

In my config.rb, I have: = "America/Los_Angeles"

(I am on OS X Mountain Lion)

Copy link

erikthered commented Jan 16, 2013

Well, that was my best guess. Maybe since the offset in your frontmatter is set for UTC (+00:00) it's causing a problem? You could try setting the timezone to UTC or removing the timezone if all of your articles are set for +00:00.

Sorry this is kind of a shot in the dark. Maybe one of the devs can help.

Copy link

debajit commented Jan 16, 2013

Yes, removing the time part of the date-time string is a workaround (so I'm not stuck or anything).
The issue that I wanted to point out here is that "middleman article " for a middleman blog creates a filename with only the date (without the time) but adds a YAML frontmatter with the date and time strings which does not build out of the box.

Copy link

tdreyno commented Jan 16, 2013


Copy link

bhollis commented Jan 18, 2013

The timestamp isn't even mandatory - it's just in the template so people know they can include it if they want multiple posts from the same day to sort correctly. We should figure out how to generate that timestamp in the specified time zone...

@bhollis bhollis closed this as completed in c33bc3e Feb 9, 2013
Copy link

bhollis commented Feb 9, 2013

OK, I've fixed it to generate the timestamp in the right time zone.

Copy link

atmosx commented May 23, 2015


I am moving from Octopress to Middleman. I made a quick script to fix the dates and worked fine for me:

require 'fileutils'
require 'time'

files = Dir.glob("*.markdown")
puts "Processing #{files.count} files"
files.each do |f|
  list = []
  list << f
  File.readlines(f).each do |line|
    if line.include?("date: ")
      string = line[6,19]
      string.include?("\n") ? s = string.strip : s = string
      time = Time.parse(string)
      FileUtils.touch f, mtime: time
puts "Finished!" 

Best regards

UPDATE: Apparently it works for SOME posts but not for others. I can't tell why though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

5 participants