Fix edit link to unversioned URLs linking to a 404 GitHub page #1121
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 theselectedVersion
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!