Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Shortcode 3.0.0 Major update available for module shortcode (3.0.0). Release: ECA: Event - Condition - Action 3.1.7 Minor update available for module eca (3.1.7). Release: ECA: Event - Condition - Action 3.0.15 Minor update available for module eca (3.0.15). Release: ECA: Event - Condition - Action 2.1.24 Minor update available for module eca (2.1.24). Release: Commerce Core 3.3.9 Minor update available for module commerce (3.3.9). Release: Modeler API 1.1.6 Minor update available for module modeler_api (1.1.6). Release: Commerce Shipping 3.0.4 Minor update available for module commerce_shipping (3.0.4). Release: Entity Usage 5.0.0-beta6 New beta version released for module entity_usage (5.0.0-beta6). Module Revived: Optional End Date 2.0.0 Module optional_end_date updated after 7 months of inactivity (2.0.0). Usage Milestone: Shortcode Module shortcode crossed 1,000 active installs.

Paragraph Anchors

2 sites No security coverage
View on drupal.org

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 into field_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 HTML id collision.
  • Read-only tracking field: field_generated_anchor_id is 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 + #anchor to 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/permissions if 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:

  1. Enable on these paragraph bundles — check the paragraph types that should get an anchor. This attaches field_generated_anchor_id (the generated slug) and field_anchor_copy_override (the per-instance copy button override) to that bundle. Unchecking a bundle removes both fields from it.
  2. 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.
  3. 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.

  • 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 an aria-label ("Copy link to this section"), translatable via Drupal.t(). The same text is also set as a title attribute, so sighted mouse users get a native hover tooltip too — aria-label alone 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>:focus outline (not :focus-visible-only, so it isn't dependent on browser support). A visually-hidden aria-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 an aria-label'd button isn't reliably re-announced by assistive tech.
  • Visibility: gated by the access paragraph anchor copy links permission 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

Tracked releases
5
Tracked since
Jul 2026
Latest release
1 month ago
Releases (12 mo)
5 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core 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