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

Bug: Local Preview "file not found" with anchor links on refresh #412

Open
greghesp opened this issue Feb 18, 2025 · 0 comments
Open

Bug: Local Preview "file not found" with anchor links on refresh #412

greghesp opened this issue Feb 18, 2025 · 0 comments

Comments

@greghesp
Copy link
Contributor

greghesp commented Feb 18, 2025

When using local preview mode, if you click on an anchor link, change your content and reload the page, it will throw a page not found error. To resolve, if you remove the anchor link from the URL and refresh, the page loads

To Replicate

  1. Create a page, with a H2 header
---
title: Test
---

Test Page

## Anchor Link

Test Anchor
  1. Load the page using docs.page/preview
  2. Click on the anchor link, which sets the browser URL to https://docs.page/preview/testpage#anchor-link
    4 Hit Ctrl+R

Image

  1. To resolve - remove the anchor link, ie https://docs.page/preview/testpage

The cause of the issue appears to be here: https://github.com/invertase/docs.page/blob/main/website/src/layouts/preview/utils.ts#L265-L267

Its looking for page#anchor.mdx. To confirm this, you can create another page called page#anchor.mdx in your directory. When you go through the steps above, it will load the page#anchor.mdx file rather than page.mdx

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

No branches or pull requests

1 participant