Repository navigation
Fix: markdown routes & copy page button - #511
Merged
Merged
Conversation
- Markdown routes (`/api/content/{path}.md`) no longer fetch the page over
HTTP, which fails on Workers (522). Prerendered pages are read from the
ASSETS binding, on-demand pages are rendered with `rewrite()`, and
`astro dev` fetches from the dev server.
- "Copy page" fetches the markdown from the current origin and starts the
clipboard write within the click, so it works locally, on previews and
in Safari.
- "Copy page" gets a copy icon, icon/text alignment and spacing matching
the breadcrumbs; the dropdown items no longer show an external link icon.
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://fix-pages-as-markdown-head-start.voorhoede.workers.dev (commit 152fb4b)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Changes
Why: since the move to Workers (#463), every
.mdroute returned a 522 and the "Copy page" button showed "Failed". This PR fixes both.Details:
rewrite(), because a Worker can't fetch its own URL. Inastro devthey fetch from the dev server.Associated issue
Follow-up of #463 (migrate to Workers).
How to test
npm run devand open/api/content/en.md: returns markdown with frontmatter./api/content/en/does-not-exist.mdreturns 404.Checklist
I have made updated relevant documentation files (in project README, docs/, etc)I have added a decision log entry if the change affects the architecture or changes a significant technologyI have notified a reviewerJust fixes I double checked myself, also in another project. If something breaks, we can do a follow-up.