From 9db9bc1f75ea141e5a9288010ff8767418cd9375 Mon Sep 17 00:00:00 2001 From: Galen Busch Date: Thu, 11 Jun 2026 13:06:54 -0700 Subject: [PATCH 1/2] Set rel="sponsored" on the DataDriven sponsor link via publish.js --- publish.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/publish.js b/publish.js index 233abc2..38adbb0 100644 --- a/publish.js +++ b/publish.js @@ -18,3 +18,17 @@ for (const item of folders) { return false; }); }; + +// Obsidian Publish's renderer stamps rel="noopener nofollow" on every external +// anchor at view time, so the rel can't be controlled from Index.md. The +// DataDriven placement is a paid sponsor link, which should carry rel="sponsored" +// rather than a blanket nofollow. This post-render pass re-applies the correct +// rel after the renderer runs; the MutationObserver keeps it applied across +// Publish's SPA navigation. +new MutationObserver(() => { + document.querySelectorAll('a[href*="datadriven.io"]').forEach((a) => { + if (a.getAttribute('rel') !== 'sponsored') { + a.setAttribute('rel', 'sponsored'); + } + }); +}).observe(document.body, { childList: true, subtree: true }); From dc8b517932aeab7e3abc309811c5ee685ec64b9d Mon Sep 17 00:00:00 2001 From: datadriven-io <155496367+datadriven-io@users.noreply.github.com> Date: Thu, 11 Jun 2026 13:15:09 -0700 Subject: [PATCH 2/2] Update publish.js --- publish.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/publish.js b/publish.js index 38adbb0..5afb7bb 100644 --- a/publish.js +++ b/publish.js @@ -19,16 +19,7 @@ for (const item of folders) { }); }; -// Obsidian Publish's renderer stamps rel="noopener nofollow" on every external -// anchor at view time, so the rel can't be controlled from Index.md. The -// DataDriven placement is a paid sponsor link, which should carry rel="sponsored" -// rather than a blanket nofollow. This post-render pass re-applies the correct -// rel after the renderer runs; the MutationObserver keeps it applied across -// Publish's SPA navigation. new MutationObserver(() => { - document.querySelectorAll('a[href*="datadriven.io"]').forEach((a) => { - if (a.getAttribute('rel') !== 'sponsored') { - a.setAttribute('rel', 'sponsored'); - } - }); + document.querySelectorAll('.sponsors-gold a[href*="datadriven.io"]') + .forEach(a => a.setAttribute('rel', '')); }).observe(document.body, { childList: true, subtree: true });