Skip to content

Commit 2a56d63

Browse files
author
Aoife
committed
placement
1 parent fdbee40 commit 2a56d63

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

assets/scripts/add_notebook_links.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ find _site/tutorials _site/usage _site/developers -name "index.html" 2>/dev/null
1515
if [ -f "$ipynb_file" ]; then
1616
# Check if link is already present
1717
if ! grep -q 'Download notebook' "$html_file"; then
18-
# Add as a new <li> item in the toc-actions <ul>
19-
# This appears alongside "Edit this page" and "Report an issue"
20-
# We need to add it to BOTH occurrences (sidebar and mobile footer)
21-
perl -i -pe 's/(<div class="toc-actions"><ul>)/$1<li><a href="index.ipynb" class="toc-action" download><i class="bi bi-journal-code"><\/i>Download notebook<\/a><\/li>/g' "$html_file"
18+
# Insert the notebook link AFTER the "Report an issue" link
19+
# This ensures it goes in the right place in the sidebar toc-actions
20+
# The download="index.ipynb" attribute forces browser to download instead of navigate
21+
perl -i -pe 's/(<a href="[^"]*issues\/new"[^>]*><i class="bi[^"]*"><\/i>Report an issue<\/a><\/li>)/$1<li><a href="index.ipynb" class="toc-action" download="index.ipynb"><i class="bi bi-journal-code"><\/i>Download notebook<\/a><\/li>/g' "$html_file"
2222
echo " ✓ Added notebook link to $html_file"
2323
fi
2424
fi

0 commit comments

Comments
 (0)