Drupal 11 Link Directory Part 2 Adds REST API and Chrome Extension Workflow
Hashbang Code has published the second part of Philip Norton’s Drupal 11 link directory series, moving screenshot capture from headless Chromium to a browser-extension workflow. Philip Norton writes that CDN blocks, captcha checks, and cookie popups made automated headless screenshots unreliable, with many captures returning error pages instead of the intended site.
The article follows Part 1 of the series, which covered setting up a Drupal 11 link directory and taking screenshots as links were added. The DropTimes previously summarised that opening article in its coverage of Drupal link directory screenshots. Part 2 replaces that screenshot mechanism with a custom REST resource and a Chrome extension named Link It.
On the Drupal side, the tutorial describes a REST resource that accepts POST requests and creates or updates a Link content entity from submitted link, title, and base64 image data. Philip uses the Key Auth module for authentication, with requests first calling /session/token before sending the returned CSRF token and API key to the link creation endpoint. The post also covers a controlled SecKit bypass that uses a custom Hashbangcode-Extension header while allowing normal SecKit behaviour for unrecognised requests.
The Chrome extension uses manifest.json, a popup interface, a background service worker, and Chrome debugger permissions to capture the active tab at a fixed 1280x960 size. Philip notes that the workflow still has limits, including occasional tiled or corrupted captures when the browser window is smaller than the target size. The article includes code examples for the REST resource, SecKit handling, extension files, screenshot capture, and submission flow, and should be read directly for implementation details.


