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

Bug: Underscores in Nav Menu Change Link Names #91

Closed
phillc73 opened this issue May 12, 2019 · 4 comments
Closed

Bug: Underscores in Nav Menu Change Link Names #91

phillc73 opened this issue May 12, 2019 · 4 comments
Labels
bug 🐛 Something isn't working docs 📑

Comments

@phillc73
Copy link

phillc73 commented May 12, 2019

When using underscores in file names linked from a navigation menu, the html page links are altered, dropping everything after the underscore.

_site.yaml navigation looks like this in part:

navbar:
  right:
    - text: "Home"
      href: index.html
    - text: "Articles"
      href: articles_index.html

After the website is built, previewing in the RStudio Viewer pane and clicking on the relevant navigation bar link results in error:

/rmd_output/3/articles_./ not found

If the "Open in Browser" link is clicked and the website opens in a new Firefox tab, the link works and the correct articles_index.html file is loaded.

Initially, I thought everything was fine and the error was just somehow in the RStudio Viewer pane. However, when the website is deployed to Netlify, the error returns. In fact the file linked from the navigation menu is simply websiteurl.com/articles_./

I would link to the website, which is new and likely has zero traffic at the moment, but perhaps by the time you read this I will have fixed the error by renaming files without underscores!

If required, the website repository is at:

https://gitlab.com/phillc73/goodinplaces-website

@jjallaire
Copy link
Member

The bug here isn't the underscore, it's the "index.html" (which we are doing a global search and replace for). So, for example if you changed the name of the page to articles.html or articles_listing.html then it would work fine. Will certainly fix the underlying bug but wanted you to also know what the workaround would be.

@phillc73
Copy link
Author

Thanks @jjallaire for the details and explanation. At least I know not to call anything other pages index!

@cderv
Copy link
Collaborator

cderv commented May 11, 2022

I have opened an issue in RStudio IDE for this. I believe the issue really there.

I'll close this and we can all follow for a fix there. Thanks for the report

@cderv cderv closed this as completed May 11, 2022
@cderv cderv reopened this May 11, 2022
@cderv
Copy link
Collaborator

cderv commented May 11, 2022

In fact it is indeed something coming from distill

// get rid of index.html references in header
if (window.location.protocol !== "file:") {
$('.distill-site-header a[href]').each(function(i,val) {
$(this).attr('href', $(this).attr('href').replace("index.html", "./"));
});
}

Thanks @romainfrancois !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working docs 📑
Projects
None yet
Development

No branches or pull requests

4 participants