Paragraph Anchors
This module automatically creates unique, web-friendly IDs for paragraphs based on their titles. It can optionally add a button to copy a direct link to that specific paragraph, making it easier to share sections of your content.
About
Automatically generates a URL-safe anchor ID for Paragraph entities, based on whichever "title-like" field is populated on the paragraph, and exposes it as a read-only tracking field in the admin UI. Optionally postfixes each anchored paragraph with a "copy link" button so editors and site visitors can copy a direct link to that section.
-
Anchor generation: on save, the module scans a prioritized list of source fields (e.g.
field_title,field_heading) and slugifies the first non-empty one intofield_generated_anchor_id. If none of those fields have a value, it falls back to the paragraph's UUID so an anchor is always available. A numeric suffix (--2,--3, ...) is only added when the slug collides with another paragraph's stored anchor on the same page (the same host node/entity) â a duplicate title on a different, unrelated page never gets suffixed, since it isn't a real HTMLidcollision. -
Read-only tracking field:
field_generated_anchor_idis shown on the paragraph's edit form so editors can see the generated value, but the widget is disabled â it can't be hand-edited. This works even when the paragraph is nested inside other paragraphs (e.g. layout paragraphs). -
Copy anchor link button: a small icon button is postfixed to each anchored paragraph on the front end, pinned to the top-right corner of the component, copying the absolute page URL +
#anchorto the clipboard on click. Controlled by a site-wide default, a per-paragraph override, and a permission (see below).
Requirements
Permissions
-
Administer Paragraph Anchors settings â access to the settings form at
/admin/config/content/paragraph-anchors. Restricted by default. -
Access "copy anchor link" buttons â required for the copy-link icon button to appear at all, checked ahead of the site-wide default/ per-paragraph override below. Granted to Anonymous and Authenticated user automatically on install so the button keeps working out of the box; revoke it from specific roles at
/admin/people/permissionsif you need to restrict who sees it (e.g. hide it from anonymous visitors and only show it to logged-in editors).
Configuration
Visit Admin > Configuration > Content > Paragraph Anchors (/admin/config/content/paragraph-anchors, requires the Administer Paragraph Anchors settings permission) to configure:
-
Enable on these paragraph bundles â check the paragraph types that should get an anchor. This attaches
field_generated_anchor_id(the generated slug) andfield_anchor_copy_override(the per-instance copy button override) to that bundle. Unchecking a bundle removes both fields from it. -
Source fields (priority order) â one field machine name per line. The first field in the list with a non-empty value on a given paragraph is used to build its anchor slug. Defaults to a sensible list of common title-like fields (
field_title,field_heading,field_name,field_label,title); add your own to the list as needed. - Show 'copy anchor link' button by default â the site-wide default for the copy-link button described above. Still subject to the permission above â unchecking someone's permission hides the button regardless of this setting.
How editors use it
Once a bundle is enabled, editing a paragraph of that type shows a greyed out, monospaced Generated Anchor ID field with a description like Automated System Field: Use #your-slug-here to link here. â this updates automatically every time the paragraph is saved; it can't be typed into directly.
Each paragraph also gets a Copy anchor link button field (a simple "Use site default" / "Always show" / "Always hide" selector) so an editor can force the copy-link button on or off for one specific component, regardless of the site-wide default.
The copy-link button
-
Appearance: a small circular icon button (no text label), pinned to the top-right corner of the anchored paragraph's own wrapper via
position: absoluteâ it does not affect the component's layout or push its content down. -
Accessibility: the icon is
aria-hidden; the button's accessible name comes entirely from anaria-label("Copy link to this section"), translatable viaDrupal.t(). The same text is also set as atitleattribute, so sighted mouse users get a native hover tooltip too âaria-labelalone has no visible on-screen equivalent. It's a real</code>, so it's reachable and operable by keyboard (Tab + Enter/Space) with no extra markup needed, and gets a visible <code>:focusoutline (not:focus-visible-only, so it isn't dependent on browser support). A visually-hiddenaria-live="polite"region announces "Copied!" to screen readers when the click succeeds; it's a sibling of the button rather than nested inside it, because a live region inside anaria-label'd button isn't reliably re-announced by assistive tech. -
Visibility: gated by the
access paragraph anchor copy linkspermission first, then the site-wide default / per-paragraph override described above. All three must allow it for the button to render.
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Release Timeline
Releases
| Version | Type | Core | Notes | Release date | |
|---|---|---|---|---|---|
| 1.0.1-beta1 | Pre-release | 10–11 | Jul 24, 2026 | ||
| 1.1.x-dev | Dev | 10–11 | Jul 24, 2026 | ||
| 1.0.0-beta2 | Pre-release | 10–11 | Jul 24, 2026 | ||
| 1.0.0-beta1 | Pre-release | 10–11 | Jul 24, 2026 | ||
| 1.0.x-dev | Dev | 10–11 | Jul 24, 2026 |