middleman / middleman-blog

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

How to configure URLs of articles with underscore #376

Open molotoff opened 4 years ago

molotoff commented 4 years ago

Expected behaviour

Get the articles in build with initially names with underscore

Actual behaviour

Now all urls are replacing with dashes

Steps to reproduce the problem

  1. Create the article with underscore: name_of_article.html.markdown
  2. After the building we get this article with dashes name-of-article.html
tdreyno commented 4 years ago

Found some code in the blog extension that might explain this: https://github.com/middleman/middleman-blog/blob/master/lib/middleman-blog/uri_templates.rb#L76

molotoff commented 4 years ago

Yeah, I saw those part of code. But is fork of repository is a single way to fix those problem?

tdreyno commented 4 years ago

No, if we find a fix we can update this repository. The biggest issue is that this "bug" has been around for years so changing it now might change other users URLs. So we'd have to fix this by adding a new option to opt in the new (aka fixed) behavior.

markets commented 4 months ago

@tdreyno Do you know how can I access the blog options in that point of the code? I just made a quick look, but I can't find any way to access the blog instance here:

https://github.com/middleman/middleman-blog/blob/9bb7fc71179d2da4227aa4649e3ec6e429c880c2/lib/middleman-blog/uri_templates.rb#L80-L81

I'd like to introduce a new option to allow to opt in this behavior, as you pointed out in the comment above ☝️

tdreyno commented 4 months ago

@markets looks like a static helper function. probably best to see if there's access to the blog instance/config from wherever its being called. Can add params/options to that helper to be more configurable.

markets commented 4 months ago

Yeah, that's what I thought too.. Ok! I'll take a look taking into account this approach.