Add "Domain target" column for external links and create Views display to group and count domains

Created on 12 June 2025, 23 days ago

Problem/Motivation

The current system lacks visibility into the domain targets of external links listed in the main table. Users cannot easily identify which external domains are being linked to without inspecting the full URLs manually.

Additionally, there is a need for a dedicated Views display to group external link targets by domain and count the number of times each domain appears on the site. This would support better analysis, moderation, or reporting of external link usage and iframes.

Steps to reproduce

  • Navigate to the main table that lists links (possibly a View displaying content or link entities).
  • Observe that the column for external links displays the full URL but does not isolate or highlight the domain.
  • Try to analyze which external domains are most frequently used — no summary or domain-level aggregation is available.

Proposed resolution

Add a new column to the existing View (main table):

  • Label: Domain target
  • Content: Extract and display the domain of the URL, only for external links.
  • Logic should ensure internal links are excluded or shown as empty/null in this column.

Create a new Views display:

  • Name: Domains
  • Description: Group external links by domain and provide a count of how many times each domain is referenced.

Remaining tasks

  • Add a computed field or Views field handler to extract the domain from external URLs.
  • Update the main View to include the new Domain target column.
  • Create the new Domains Views display: Group external links by domain, Count occurrences, Optionally, sort by count descending
  • Write tests to confirm correct behavior (if part of a custom module)
  • Add documentation or admin UI description for the new Views
  • Feature request
    Status

    Active

    Version

    1.0

    Component

    Code

    Created by

    🇪🇸Spain lpeidro Madrid

    Live updates comments and jobs are added and updated live.
    Sign in to follow issues

    Comments & Activities

    Production build 0.71.5 2024