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

Is there a way to change the edit branch away from master? #2416

Closed
xyeLz opened this issue May 22, 2021 · 2 comments
Closed

Is there a way to change the edit branch away from master? #2416

xyeLz opened this issue May 22, 2021 · 2 comments

Comments

@xyeLz
Copy link

xyeLz commented May 22, 2021

I apologize if I missed something in the documentation but when I select the pen to edit my page, it always tries to bring me to the "master" branch (which does not exist as we only have a main branch) which leads us to a GitHub 404 error page. Did I miss something here or has this not been addressed yet? Thanks!

@ktomk
Copy link
Contributor

ktomk commented May 22, 2021

If you use a non-standard (mind the time of release) default branch on Github, you can not rely on the "few known hosts (specifically GitHub, Bitbucket and GitLab) [that] the edit_uri is derived from the 'repo_url'" (ref) and you have to set the edit_uri yourself.

This is also true if you use a non-standard "docs" directory.

repo_name: ktomk/pipelines
repo_url: https://github.com/ktomk/pipelines
edit_uri: ./edit/master

(Example: non-standard documentation root in a Github repository, docs folder is project root and default branch is master)

Feel free to adopt the values according to your repository, the edit_uri might be something like ./edit/main/docs in your case.

(comment against mkdocs 1.1.2)

@oprypin
Copy link
Contributor

oprypin commented Jun 29, 2021

That answer is correct.
Myself, I use this for GitHub, as I find it less intrusive:

edit_uri: blob/master/docs/

and indeed you can set any other branch than master

@oprypin oprypin closed this as completed Jul 5, 2021
fghaas added a commit to citynetwork/docs that referenced this issue Feb 17, 2022
Add information about where the documentation is hosted, and how one
can contribute to it.

Since Mkdocs presently assumes that the default branch in a repo is
always named "master" and we're using main, set edit_uri to the
correct path for the main branch.

Reference:
mkdocs/mkdocs#2416
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