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