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 link fallback not working #981

Closed
1 task
trueberryless opened this issue Oct 24, 2023 · 5 comments · Fixed by #985
Closed
1 task

Edit page link fallback not working #981

trueberryless opened this issue Oct 24, 2023 · 5 comments · Fixed by #985

Comments

@trueberryless
Copy link
Contributor

What version of starlight are you using?

0.11.0

What version of astro are you using?

3.0.6

What package manager are you using?

pnpm

What operating system are you using?

Windows

What browser are you using?

Brave

Describe the Bug

When clicking "Edit page" at the bottom of the page (when enabled) but the page is not available in the current language (the fallback page is currently shown instead), then the link does not use a link to GitHub to the fallback page but to a page that does not exists, therefore leading to this page:

image

I at least encountered this problem, when English is not the default local...

Link to Minimal Reproducible Example

https://starlight.astro.build/de/guides/overriding-components/

Participation

  • I am willing to submit a pull request for this issue.
@delucis
Copy link
Member

delucis commented Oct 24, 2023

Ah, good point! I wonder what the correct behaviour is.

  • Link to edit the default locale file being used for fallback content
  • Link to create a new file for the current language
  • Hide the edit link on pages using fallback content

@HiDeoo
Copy link
Member

HiDeoo commented Oct 24, 2023

Link to create a new file for the current language

This is something I did in a project by overriding the <EditLink/> component when isFallback is true and I changed the sentence to "Translate this page" and the link uses the filename query parameter to specify which file to create (the value one is not really usable to pre-fill the file content).

I personally like that behavior a lot.

@delucis
Copy link
Member

delucis commented Oct 24, 2023

Yes, I think I agree that would also be the ideal behaviour although it would require some more config for a create-page base URL, and a new string in our translation dictionaries.

Given the increasing config complexity, it may also be nice to provide some presets for common hosts to avoid everyone having to figure out the base URLs when it can be done based on repo + branch etc.

@trueberryless
Copy link
Contributor Author

trueberryless commented Oct 24, 2023

I personally only thought about behaviour 1 (Link to edit the default locale file being used for fallback content)...
Therefore, I would say, this should be the default behaviour, but maybe the behaviour could also be chosen by the developer in astro.config.mjx...

Maybe there could even be multiple buttons on the bottom: "Edit this page", "Create page in your language"...

@delucis
Copy link
Member

delucis commented Oct 24, 2023

Maybe it would be smart to split this into two steps:

  1. Fix the current behaviour to point to the existing file

  2. Treat support for a "Translate this page" link as a feature request

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.

3 participants