Add better support for linking to anchors

Created on 23 December 2018, almost 6 years ago
Updated 2 February 2023, almost 2 years ago

It's technically possible to link to anchors in the following way:

  • If linking to an anchor on the same page, just use #anchor-name as the URL. LinkIt searcher will say that no content has been found matching that URL and it will be placed as is.
  • If linking to an anchor on some internal path that you just searched for, you can also manually append the #anchor-name to the end of the URL

The 2nd way is the problematic one. The problem is that when you append the fragment to the path, LinkIt will no longer return the data-entity-type and data-entity-uuid attribues for the <a&rt; tag that it inserts. This means that any substitution plugins (like one that converts an internal node path to the proper path alias) will no longer work.

I wonder if there's a way to improve this behavior so that fragments manually added to a URL do not interfere with the process.

โœจ Feature request
Status

Needs work

Version

5.0

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States bkosborne New Jersey, USA

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024