Skip to content

Commit a678a24

Browse files
committed
Match url instead of doc file path in ignore patterns
1 parent d3679b0 commit a678a24

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

jupyterlite_sphinx/jupyterlite_sphinx.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,12 @@ window.tryExamplesHideIframe = (examplesContainerId, iframeParentContainerId) =>
7878
}
7979

8080

81-
window.loadTryExamplesConfig = (ignoreFilePath, currentPagePath) => {
81+
window.loadTryExamplesConfig = (ignoreFilePath) => {
8282
// Add a timestamp as query parameter to ensure a cached version of the
8383
// file is not used.
8484
const timestamp = new Date().getTime();
8585
const ignoreFileUrl = `${ignoreFilePath}?cb=${timestamp}`;
86+
const currentPageUrl = window.location.pathname;
8687
fetch(ignoreFileUrl)
8788
.then(response => {
8889
if (!response.ok) {
@@ -103,7 +104,7 @@ window.loadTryExamplesConfig = (ignoreFilePath, currentPagePath) => {
103104
const regexPatterns = data.ignore_patterns;
104105
for (let pattern of regexPatterns) {
105106
let regex = new RegExp(pattern);
106-
if (regex.test(currentPagePath)) {
107+
if (regex.test(currentPageUrl)) {
107108
var buttons = document.getElementsByClassName('try_examples_button');
108109
for (var i = 0; i < buttons.length; i++) {
109110
buttons[i].classList.add('hidden');

jupyterlite_sphinx/jupyterlite_sphinx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ def run(self):
535535
script_html = (
536536
"<script>"
537537
'document.addEventListener("DOMContentLoaded", function() {'
538-
f'window.loadTryExamplesConfig("{config_path}","{docname}");'
538+
f'window.loadTryExamplesConfig("{config_path}");'
539539
"});"
540540
"</script>"
541541
)

0 commit comments

Comments
 (0)