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

Blog - Relative links in blog truncated content (list view) are breaking #9731

Open
6 tasks done
slorber opened this issue Jan 11, 2024 · 1 comment
Open
6 tasks done
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@slorber
Copy link
Collaborator

slorber commented Jan 11, 2024

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

Links such as [heading](#headingId) will work on the actual blog post page

But those links won't work on the list views where the blog is truncated with the {/* truncate */} marker.

This is because those relative links are resolved against the current page, and not the blog post permalink.

We should write a Remark plugin that will resolve the blog post links so that we have absolute links in list views, ensuring the links work in both list and detail views.


Example in production: https://docusaurus.io/blog/tags/search

CleanShot 2024-01-11 at 19 43 10

This link doesn't work because the heading is not available on this page.

(I'm going to remove this example so it will not be browsable soon)

@slorber slorber added the bug An error in the Docusaurus core causing instability or issues with its execution label Jan 11, 2024
@slorber slorber changed the title Blog - Relative links in blog truncated excerp a are breaking Blog - Relative links in blog truncated content (list view) are breaking Jan 11, 2024
@Mishra-Pravin
Copy link

@slorber Sir Can you please describe the bug in detail?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution
Projects
None yet
Development

No branches or pull requests

3 participants
@slorber @Mishra-Pravin and others