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

"Edit page" URLs incorrect #1

Closed
jamesrhea opened this issue Mar 5, 2018 · 7 comments
Closed

"Edit page" URLs incorrect #1

jamesrhea opened this issue Mar 5, 2018 · 7 comments

Comments

@jamesrhea
Copy link
Contributor

jamesrhea commented Mar 5, 2018

The "edit page" button (pencil icon) link on the docs site does not work. For example, on this page https://retropie.org.uk/docs/ the link goes to https://github.com/RetroPie/RetroPie-Setup/edit/master/docs/index.md. What should the correct link be? I don't see where these source markdown files are located. Within the RetroPie-Docs repo?

@HerbFargus
Copy link
Member

The material theme by default assumes the docs are hosted on a GitHub repository but we build them from the retropie wiki itself (which is technically a repository to but not the type that's expected)

https://github.com/RetroPie/RetroPie-Setup/wiki

Two options for us are to remove the edit on github links, or find a way to point them to where they actually reside. My preference would be the former.

@jamesrhea
Copy link
Contributor Author

jamesrhea commented Mar 5, 2018

What would happen if you changed repo_url within https://github.com/RetroPie/RetroPie-Docs/blob/master/mkdocs.yml to "https://github.com/RetroPie/RetroPie-Setup/wiki"?

The other config possibility is to use the edit_uri config option: http://www.mkdocs.org/user-guide/configuration/#edit_uri.

@HerbFargus
Copy link
Member

HerbFargus commented Mar 5, 2018

So from the docs mkdocs appends the repo_url with the edit_uri to get an editable link.

Changing the repo url wouldn't really solve it. for example:

The default (incorrect) link to edit the home page is:

https://github.com/Retropie/RetroPie-Setup/edit/master/docs/index.md

This assumes it's hosted on a github wiki, but even if we switched it to https://github.com/RetroPie/RetroPie-Setup/wiki it wouldn't work since it would append an edit path incorrectly:

https://github.com/RetroPie/RetroPie-Setup/wiki/edit/master/docs/index.md

lets say we manually redefine the edit_uri to just the root path /

You still would get:

https://github.com/RetroPie/RetroPie-Setup/wiki/edit/index.md

which doesn't work as the wiki edit urls resolve to:

https://github.com/RetroPie/RetroPie-Setup/wiki/Home/_edit

(btw the home page will always be perpetually broken since the github wiki's home page is named Home.md whereas mkdocs looks for index.md as the home page so in our conversion script we end up renaming Home.md to index.md

So if there is a way to have the edit_uri use variables or wildcards (perhaps that's what they mean by fragments or query characters) of sorts like

/wiki/$pagename/_edit

It might work for all but the home page. but I haven't tested it. note this is all conjecture based on how I understand the docs, I haven't validated it with any real tests as of yet

@HerbFargus
Copy link
Member

From my tests:

using something like

edit_uri: '/RetroPie/RetroPie-Setup/wiki/'

On the installation page it will resolve to:

https://github.com/RetroPie/RetroPie-Setup/wiki/First-Installation.md

which redirects to:

https://raw.githubusercontent.com/wiki/RetroPie/RetroPie-Setup/First-Installation.md

And even if we were able to append _edit to the URL it would yield this:

https://github.com/RetroPie/RetroPie-Setup/wiki/First-Installation.md/_edit

Instead of the correct page:

https://github.com/RetroPie/RetroPie-Setup/wiki/First-Installation/_edit

So unless I'm missing some fancy querying sorcery to strip the markdown extension and append _edit this just wasn't designed for our conversion use case.

@joolswills
Copy link
Member

I have implemented a workaround for this using a small php script on our server that redirects to the correct page. This avoids having to modify mkdocs.

@jamesrhea
Copy link
Contributor Author

@joolswills - I've submitted a request for MkDocs to support wiki URLs. But I'm wondering: would this JavaScript snippet have also done the trick?

https://github.com/mkdocs/mkdocs/wiki/MkDocs-Recipes#associate-github-page-with-current-mkdoc-page

@joolswills
Copy link
Member

Could be yeah, although I will probably just stick with the current solution for now.

Thanks for submitting a request upstream.

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