• iangreig

    (@iangreig)


    I am having difficulty creating an anchor link to a specific paragraph on a page. I can link to the page.I can jump to the paragraph. I can’t seem to get the link to open, or navigate to, a specific paragraph.

    I have tried setting an id in Ult imate Blocks — no good.

    I have tried setting an id above the heading e.g.
    <a></a>

    and then appending it to the page link.

    One strange behaviour I have noticed (WordPress 5.2) is that the hyperlink dialog searches for the id and finds it. Then it prefixes it withhttps://— and of course it doesn’t work because it is an anchor, not a hyperlink.

    Where am I going wrong?

Viewing 1 replies (of 1 total)
  • Joy

    (@joyously)

    To make the link to a different page, you need both the URL and the anchor (fragment identifier). https://example.com/my-other-page/#paragraph2
    To make the link in the same page, you only need the anchor. #paragraph2 But if will work just fine if you include the entire URL.

    Adding the ID to the block seems to be a problem. It isn’t part of the editor interface, and adding it directly to the HTML causes the editor to invalidate the block.
    Perhaps you should see if this issue was raised already, or open a new issue:
    https://github.com/WordPress/gutenberg/issues/

Viewing 1 replies (of 1 total)
  • The topic ‘Anchor links post to specific para on page’ is closed to new replies.