Skip to content

Edit URL leads to 404 if you've specified a custom src directory #1543

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

Closed
anoadragon453 opened this issue May 24, 2021 · 0 comments · Fixed by #1554
Closed

Edit URL leads to 404 if you've specified a custom src directory #1543

anoadragon453 opened this issue May 24, 2021 · 0 comments · Fixed by #1554

Comments

@anoadragon453
Copy link
Contributor

It looks like the code that generates the URL that users navigate to when clicking on the "Suggest an edit" button (added in #1506) assumes that your documentation is stored in a directory called src.

if let Some(ref edit_url_template) = ctx.html_config.edit_url_template {
let full_path = "src/".to_owned()
+ ch.source_path
.clone()
.unwrap_or_default()
.to_str()
.unwrap_or_default();
let edit_url = edit_url_template.replace("{path}", &full_path);
ctx.data
.insert("git_repository_edit_url".to_owned(), json!(edit_url));
}

As I've customised the directory where my documentation files are stored by using the src config option (to be docs/ instead), I end up getting a 404 when I click the "Suggest an edit" menu item button.

When I click the button, I'm lead to https://github.com/anoadragon453/examplerepo/edit/develop/src/README.md instead of https://github.com/anoadragon453/examplerepo/edit/develop/docs/README.md.

I believe the above code just needs to read from the value of the src config option, and default to "src" if it's not set.

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

Successfully merging a pull request may close this issue.

1 participant