Skip to content

Commit b30fddc

Browse files
committed
fix: decorate external links shown after listing pagination
1 parent bd251a8 commit b30fddc

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

‎src/resources/formats/html/templates/quarto-html-after-body.ejs‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,11 @@
233233
return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
234234
}
235235
// Inspect non-navigation links and adorn them if external
236-
var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool):not(.about-link)');
236+
window.quartoDecorateExternalLinks = function (root) {
237+
var links = (root || window.document).querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool):not(.about-link):not([data-quarto-external])');
237238
for (var i=0; i<links.length; i++) {
238239
const link = links[i];
240+
link.dataset.quartoExternal = "";
239241
if (!isInternal(link.href)) {
240242
// undo the damage that might have been done by quarto-nav.js in the case of
241243
// links that we want to consider external
@@ -274,6 +276,8 @@
274276
}
275277
}
276278
}
279+
};
280+
window.quartoDecorateExternalLinks(window.document);
277281
278282
279283
@@ -800,4 +804,4 @@
800804
}).replace(/</g, '\\u003c') %>;
801805
</script>
802806
<% } %>
803-
807+

‎src/resources/projects/website/listing/quarto-listing.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ window["quarto-listing-loaded"] = () => {
4747
// and refresh any newly visible items.
4848
list.on("updated", function () {
4949
renderVisibleProgressiveImages(list);
50+
window.quartoDecorateExternalLinks?.(list.list);
5051
setTimeout(() => refreshPaginationHandlers(listingId));
5152

5253
// Show or hide the no matching message

0 commit comments

Comments
 (0)