diff --git a/tuftecms/templates/base.html b/tuftecms/templates/base.html
index 449d0b9..749b79a 100644
--- a/tuftecms/templates/base.html
+++ b/tuftecms/templates/base.html
@@ -591,8 +591,8 @@
// Python class names (class ClassName)
html = html.replace(/(\bclass\s+)([A-Za-z_][A-Za-z0-9_]*)/g, '$1$2');
- // JavaScript/C++/Java comments (// comment)
- html = html.replace(/(\s*\/\/.*)$/gm, '$1');
+ // JavaScript/C++/Java comments (// comment) - only at line start, not in URLs
+ html = html.replace(/^(\s*\/\/.*)$/gm, '$1');
// CSS/C/Java block comments (/* comment */)
html = html.replace(/(\/\*[\s\S]*?\*\/)/g, '$1');