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 this page on GitHub button link breaks often #991

Closed
sanamiy opened this issue Dec 3, 2021 · 7 comments
Closed

Edit this page on GitHub button link breaks often #991

sanamiy opened this issue Dec 3, 2021 · 7 comments
Labels
bug Something isn't working

Comments

@sanamiy
Copy link

sanamiy commented Dec 3, 2021

Version

@nuxt/content: v1.15.1
nuxt: 2.15.3
@nuxt/content-theme-docs: v0.11.1

Reproduction Link

https://pwa.nuxtjs.org/
https://github.com/nuxt-community/pwa-module/tree/main/docs

Steps to reproduce

Edit this page on GitHub button links always break when create a document site with @nuxt/content-theme-docs and the /content folder is directory belongs to the main directory. ~/content/*.md

case of failure: https://pwa.nuxtjs.org/
broken Edit this page on GitHub link:
https://github.com/nuxt-community/pwa-module/edit/master/docs/content/en/index.md

on the other hand, if /content folder is under docs folder the link do not break.
~/docs/content/*.md
case of success:https://content.nuxtjs.org/
Edit this page on GitHub link: https://github.com/nuxt/content/edit/main/docs/content/ja/index.md

What is actually happening?

the string in links /docs is the cause of this bug.
The string in links /docs should be option.
or if the option already exists, please tell me.

Thank you,

@sanamiy sanamiy added the bug Something isn't working label Dec 3, 2021
@sanamiy sanamiy changed the title ### **Edit this page on GitHub** button link breaks easily. **Edit this page on GitHub** button link breaks easily. Dec 4, 2021
@sanamiy sanamiy changed the title **Edit this page on GitHub** button link breaks easily. Edit this page on GitHub button link breaks often Dec 4, 2021
@NozomuIkuta
Copy link
Collaborator

@sanamiy

Thank you for reporting an issue.

It seems that both cases, failure and success, result in NOT FOUND error.
Would you elaborate your situation a little bit more?

@sanamiy
Copy link
Author

sanamiy commented Dec 5, 2021

sorry, I’ve pasted wrong links in success case, so I corrected that.
The edit GitHub buttons in docs of @nuxt/content are ok.

@NozomuIkuta
Copy link
Collaborator

@sanamiy

Thank you for fixing the sample. 🙌

Actually, URL to edit a file can be configured via options: defaultBranch and defaultDir, as written in documentation.

FYR, here is the code:

link () {
if (!this.settings.github) {
return
}
return [
this.githubUrls.repo,
'edit',
this.settings.defaultBranch,
this.settings.defaultDir,
`content${this.document.path}${this.document.extension}`
].filter(path => !!path).join('/')
}
}


By the way, in this time, it's not because of defaultDir why the link to edit PWA module documentation is broken.
It's because defaultBranch is wrong.

Nuxt core team renamed the default branch of their repositories from master to main a while ago.
But it seems that they didn't fix Theme Docs option.

I will check and fix other module documentation as needed.
Again, thank you for reporting! 👍

@NozomuIkuta
Copy link
Collaborator

NozomuIkuta commented Dec 5, 2021

One thing to correct.

Nuxt core team renamed the default branch of their repositories from master to main a while ago.
But it seems that they didn't fix Theme Docs option.

I noticed that main branch is default value of defaultDir option.
So they didn't have to fix Theme Doc option when they change the default branch of the repositories.

The fact seems to be that PWA module documentation is not up-to-date. 🤔
I confirmed that the link is correct in my local environment.

I will open an issue in PWA module repository (as well as keeping checking other documentation).

@NozomuIkuta
Copy link
Collaborator

Oh, you already created one.
Thank you so much! 🙌

nuxt-community/pwa-module#500

@sanamiy
Copy link
Author

sanamiy commented Dec 9, 2021

Thank you so much, @NozomuIkuta !
Problems were all solved by defaultBranch and defaultDir options!
I confirmed that in docs of pwa module problems was not caused by dir but by branch.
Thank you for telling me ☺️

@danieldevine
Copy link

as written in documentation

Ironically, this link is 404. Is this documentation still available somewhere?

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

No branches or pull requests

3 participants