← back to Rentv 2026
pr/linkedin: unify the ' | LinkedIn' SERP-suffix strip into one stripLinkedIn() helper. The two call sites had drifted to different separator classes (locatePerson [|–-] vs discoverComms [|·]), so 'LinkedIn' leaked into stored indexed_title on middot/en-dash/em-dash separators. One helper covers [|·–—-]; verified all separators stripped, legit + mid-word-LinkedIn titles preserved
dc165ff3bb41e15c129bc9603c125b01b5d1046d · 2026-08-05 20:55:55 -0700 · Steve
Files touched
M src/pr/adapters/linkedin.js
Diff
commit dc165ff3bb41e15c129bc9603c125b01b5d1046d
Author: Steve <steve@designerwallcoverings.com>
Date: Wed Aug 5 20:55:55 2026 -0700
pr/linkedin: unify the ' | LinkedIn' SERP-suffix strip into one stripLinkedIn() helper. The two call sites had drifted to different separator classes (locatePerson [|–-] vs discoverComms [|·]), so 'LinkedIn' leaked into stored indexed_title on middot/en-dash/em-dash separators. One helper covers [|·–—-]; verified all separators stripped, legit + mid-word-LinkedIn titles preserved
---
src/pr/adapters/linkedin.js | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/pr/adapters/linkedin.js b/src/pr/adapters/linkedin.js
index 24984fff..221cd144 100644
--- a/src/pr/adapters/linkedin.js
+++ b/src/pr/adapters/linkedin.js
@@ -10,6 +10,10 @@ const { report, register } = require('./index');
const search = require('./search');
const { normalizeLinkedInUrl } = require('../lib/normalize');
+// Strip the trailing " | LinkedIn" / " · LinkedIn" / " – LinkedIn" (any separator) SERP suffix from
+// a result title. One helper so the two call sites can't drift on which separators they cover.
+const stripLinkedIn = (t) => String(t || '').replace(/\s*[|·–—-]\s*LinkedIn\b.*$/i, '').trim();
+
const adapter = register({
name: 'linkedin',
kind: 'enrichment',
@@ -25,7 +29,7 @@ const adapter = register({
const rep = await search.findLinkedIn({ personName: full_name, companyName: organization_name, kind: 'in' });
const items = rep.items.map((x) => ({
linkedin_url: normalizeLinkedInUrl(x.url),
- indexed_title: (x.title || '').replace(/\s*[|–-]\s*LinkedIn.*$/i, '').trim(),
+ indexed_title: stripLinkedIn(x.title),
indexed_snippet: (x.snippet || '').slice(0, 400),
source_url: x.url,
status_recommendation: 'found_uncorroborated',
@@ -55,7 +59,7 @@ const adapter = register({
const blob = ((x.title || '') + ' ' + (x.snippet || '')).toLowerCase();
if (!blob.includes(orgLower)) continue;
// "Jane Smith - Director of Communications - CBRE | LinkedIn" (en/em dashes too)
- const clean = (x.title || '').replace(/\s*[|·]\s*LinkedIn.*$/i, '').trim();
+ const clean = stripLinkedIn(x.title);
const parts = clean.split(/\s+[-–—]\s+/);
const full_name = (parts[0] || '').trim();
if (!/^[A-Z][a-zA-Z'’.-]+(\s+[A-Z][a-zA-Z'’.-]+){1,3}$/.test(full_name)) continue;
← 3c791fc6 auto-save: 2026-08-05T20:45:35 (7 files) — data/deals-regist
·
back to Rentv 2026
·
pr/linkedin: anchor stripLinkedIn to the LAST separator-befo 2221ee51 →