middleman / middleman-blog

Blog Engine Extension for Middleman
https://middlemanapp.com
MIT License
326 stars 179 forks source link

Fix article subdirectory files when used with directory_indexes #304

Closed turley closed 8 years ago

turley commented 8 years ago

When directory_indexes is used along with a permalink without a file extension (e.g., "{year}/{month}/{day}/{title}") and subdirectory files exist, the current behavior causes the first subdirectory file to be written to the (permalink) path that should be used for the article itself.

Specifically, when the permalink has no file extension, then @subdir_permalink_template ends up missing the {+path} element (https://github.com/middleman/middleman-blog/blob/master/lib/middleman-blog/blog_data.rb#L40), meaning that the output path doesn't include the relative filename.

I'm not 100% sure what the best solution is, but this attempts to fix it by optionally matching an extension (if it exists) with the regular expression, though it will still make the substitution at the end of the permalink either way.

turley commented 8 years ago

FYI, this issue seems to be (at least somewhat) related to https://github.com/middleman/middleman/issues/818, https://github.com/middleman/middleman-blog/issues/137, and possibly others.

coveralls commented 8 years ago

Coverage Status

Changes Unknown when pulling cd27610f749b39633ee2038e5b757317e5739242 on turley:master into \ on middleman:master**.