Skip to content

Fix edit link to unversioned URLs linking to a 404 GitHub page #1121

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

Merged
merged 1 commit into from
May 17, 2023

Conversation

AndrewJakubowicz
Copy link
Contributor

@AndrewJakubowicz AndrewJakubowicz commented May 17, 2023

Issue

Recently we added #1107 which generates unversioned files from the latest versioned directory. This broke the edit links for unversioned files.

Repro:

On an unversioned URL, try and edit the page. E.g., https://lit.dev/docs/#:~:text=reusable%2C%20maintainable%20code.-,Edit%20this%20page,-Next

Issue is that we end up navigating to https://github.com/lit/lit.dev/edit/main/packages/lit-dev-content/site/docs/unversioned/index.md, which does not exist because the /unversioned/ subdirectory is generated.

Fix

Swap out /unversioned/ with the selectedVersion for that page - which points to where the file was copied from. /unversioned/index.html will become /v2/index.html, which exists and can be edited.

Change is a build time fix.

Cleanup

I removed litdev-edit-this-page which is not defined and therefore never renders anything. It was added in this commit https://github.com/lit/lit.dev/pull/919/files#diff-37acd914daae6f611ba2456cb543eb346fbdf40de724300d259ff940ef20ef79R43 and I think it may have been an accident. As the element doesn't render anything I think this is a no-op removal. I tried to search the repo for any references and couldn't find any.

Thank you!

I also removed `litdev-edit-this-page` which is not defined and
therefore never renders anything.
@github-actions
Copy link

A live preview of this PR will be available at the URL(s) below.
The latest URL will be appended to this comment on each push.
Each build takes ~5-10 minutes, and will 404 until finished.

https://pr1121-08307cc---lit-dev-5ftespv5na-uc.a.run.app/

@AndrewJakubowicz AndrewJakubowicz requested a review from augustjk May 17, 2023 22:13
Copy link
Member

@augustjk augustjk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix! I also could not find any other reference to litdev-edit-this-page so seems safe to remove.

@AndrewJakubowicz AndrewJakubowicz merged commit 4d73d7b into main May 17, 2023
@AndrewJakubowicz AndrewJakubowicz deleted the fix-edit-link branch May 17, 2023 22:19
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 this pull request may close these issues.

2 participants