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

Matching to path issue #15

Open
chrism opened this issue Mar 22, 2017 · 3 comments
Open

Matching to path issue #15

chrism opened this issue Mar 22, 2017 · 3 comments

Comments

@chrism
Copy link

chrism commented Mar 22, 2017

Using the gem I've found that the current_path includes forward slashes like this /link/ so that it fails to match the path using ==.

I've managed to fix this by changing it to

    if current_path.include? path
      link_options.merge!("aria-current" => aria_current)
    end

But wondered if this is a good approach?

@tysongach
Copy link
Contributor

Can you share the source for the links you’re generating? I’m curious why it seems to match fine in our tests, but you have a case where it is not matching.

@chrism
Copy link
Author

chrism commented Mar 29, 2017

Sure,

I don't think I'm doing anything too unusual but am new to middleman.

I've created a template in my source directory called writing.html.erb and in my layouts/layout.erb am referencing it like this

<%= current_link_to 'Writing', 'writing' %>

@monicakogler
Copy link

I had the same issue – thanks for the fix @chrism!

allanwhite added a commit to allanwhite/middleman-aria_current that referenced this issue Jan 9, 2018
Referencing issue thoughtbot#15 on line 19:

`if current_path.include? path`

Works in my tests, and the explicit match before did not work.
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