Skip to content

Blog anchor links in paginated lists should be resolved against blog post url, not current url #10287

Open

Description

@afunk-anduril

Have you read the Contributing Guidelines on issues?

Prerequisites

Description

Anchor tags shown on an entry of https://docusaurus.io/blog, doesn't go to the entry page's anchor tag. It goes to the https://docusaurus.io/blog#ANCHOR-TAG.

Reproducible demo

No response

Steps to reproduce

  1. go to https://docusaurus.io/blog with a description that links to an anchor tag on the entry's page
  2. Click on anchor tag in the entry page's one-liner description above the truncate line.
  3. Goes to broken link.

Expected behavior

Expect to go to the entry page's anchor, not to stay on the blog's home page.

Actual behavior

Stays on blog's home page.

Your environment

  • Public source code:
  • Public site URL:
  • Docusaurus version used:
  • Environment name and version (e.g. Chrome 89, Node.js 16.4):
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS):

Self-service

  • I'd be willing to fix this bug myself.

Activity

  1. added
    bug
    status: needs triage
    on Jul 9, 2024
  2. OzakIOne commented on Jul 10, 2024

    @OzakIOne
    Contributor

    I'm not sure that I understood, you expect https://docusaurus.io/blog#Docusaurus-3.1 to scroll to Docusaurus 3.1 title ?

  3. slorber commented on Jul 10, 2024

    @slorber
    Collaborator

    It's hard to understand what it's about indeed, can you please provide a concrete runnable example and screenshots?

    What I think I understand is that you have anchor tag links [xyz](#xyz) appearing above the blog <!-- truncate --> marker (if any), so they get rendered in the blog paginated views. And you expect clicking those anchors to lead to https://docusaurus.io/blog/post#xyz instead of https://docusaurus.io/blog/#xyz, is that correct?

  4. removed
    status: needs triage
    on Jul 10, 2024
  5. Josh-Cena commented on Jul 10, 2024

    @Josh-Cena
    Collaborator

    @slorber Yes, I believe what you said is the expected behavior.

    I could see a reason for wanting this, and I don't think it's impossible to build—we just need to resolve anchor links to absolute URLs. I'm actually surprised if we are not doing that atm.

  6. slorber commented on Jul 11, 2024

    @slorber
    Collaborator

    I'm actually surprised if we are not doing that atm.

    Afaik no we are not doing that atm.

    It's not just anchor links, but all relative links in general (which we advise to not use, but still an edge case to solve)

  7. Josh-Cena commented on Jul 11, 2024

    @Josh-Cena
    Collaborator

    It occurs to me as safe to normalize them, since each page can only map to one slug. But I'm not sure if the Markdown loader can be aware of the current page's mapped URL, or how we should take care of imported Markdown, etc.

    Maybe we can at least do this in the blog plugin that processes the truncated query? Not sure.

  8. changed the title [-]Blog description links broken[/-] [+]Blog anchor links above truncate markers should be resolved against blog post url instead of current url[/+] on Aug 9, 2024
  9. changed the title [-]Blog anchor links above truncate markers should be resolved against blog post url instead of current url[/-] [+]Blog anchor links in paginated lists should be resolved against blog post url, not current url[/+] on Aug 9, 2024
  10. PranavSharma124 commented on Nov 23, 2026

    @PranavSharma124

    Hello, I would like to work on this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions