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

How to configure URLs of articles with underscore #376

Open
molotoff opened this issue Jan 23, 2020 · 6 comments
Open

How to configure URLs of articles with underscore #376

molotoff opened this issue Jan 23, 2020 · 6 comments

Comments

@molotoff
Copy link

molotoff commented Jan 23, 2020

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
  • Ruby version: 2.3.3
  • Middleman version: 4.2.1
  • Middleman Blog version: 4.0.3
  • OS version: MacOS 10.15.2
@tdreyno
Copy link
Member

tdreyno commented Feb 4, 2020

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
Copy link
Author

molotoff commented Feb 4, 2020

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

@tdreyno
Copy link
Member

tdreyno commented Feb 8, 2020

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.

@github-actions github-actions bot added the Stale label Apr 11, 2024
@markets markets removed the Stale label Apr 18, 2024
@markets
Copy link
Member

markets commented May 5, 2024

@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:

# Replace all _ with -
parameterized_string.tr!('_', '-')

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

@tdreyno
Copy link
Member

tdreyno commented May 6, 2024

@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
Copy link
Member

markets commented May 6, 2024

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

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

No branches or pull requests

3 participants