AashishAIHub commited on
Commit
26201c8
·
1 Parent(s): 797e92e

fix: update copyright to 2026, fix search navigation for deployed sites

Browse files

- Copyright year updated from 2024 to 2026
- Search navigateToResult now dynamically detects base path
- Works correctly on GitHub Pages, Hugging Face, and local dev

Files changed (2) hide show
  1. index.html +1 -1
  2. shared/js/search.js +37 -3
index.html CHANGED
@@ -695,7 +695,7 @@
695
  rel="noopener">Hugging Face</a>
696
  <a href="README.md" class="footer-link">Documentation</a>
697
  </div>
698
- <p>© 2024 Aashish Garg. Built with ❤️ for the Data Science community.</p>
699
  </footer>
700
  </div>
701
 
 
695
  rel="noopener">Hugging Face</a>
696
  <a href="README.md" class="footer-link">Documentation</a>
697
  </div>
698
+ <p>© 2026 Aashish Garg. Built with ❤️ for the Data Science community.</p>
699
  </footer>
700
  </div>
701
 
shared/js/search.js CHANGED
@@ -421,11 +421,45 @@
421
  function navigateToResult(path) {
422
  closeSearch();
423
 
424
- // Determine base path
 
425
  const currentPath = window.location.pathname;
426
- const basePath = currentPath.includes('DataScience-v2') ? '/DataScience-v2' : '/DataScience';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
427
 
428
- window.location.href = basePath + path;
 
 
429
  }
430
 
431
  /**
 
421
  function navigateToResult(path) {
422
  closeSearch();
423
 
424
+ // Dynamically determine base path from current location
425
+ // Works on GitHub Pages (/DataScience/), Hugging Face (/), and local dev
426
  const currentPath = window.location.pathname;
427
+ // Find the root by looking for index.html or the last directory segment
428
+ const pathParts = currentPath.split('/').filter(Boolean);
429
+
430
+ // If we're at the root landing page, the base is the directory containing index.html
431
+ // e.g., /DataScience/ or /DataScience-v2/ or /
432
+ let basePath = '/';
433
+ if (pathParts.length > 0) {
434
+ // Check if last part is a file
435
+ const lastPart = pathParts[pathParts.length - 1];
436
+ if (lastPart.includes('.')) {
437
+ pathParts.pop(); // Remove filename
438
+ }
439
+ // The base is everything up to and including the repo directory
440
+ // For /DataScience/index.html -> /DataScience
441
+ // For /DataScience-v2/index.html -> /DataScience-v2
442
+ // For Hugging Face (just /index.html) -> /
443
+ if (pathParts.length > 0) {
444
+ // Find the repo root - it's the first path segment that isn't a module folder
445
+ const moduleFolders = ['DeepLearning', 'ml_complete-all-topics', 'complete-statistics',
446
+ 'math-ds-complete', 'feature-engineering', 'Visualization',
447
+ 'prompt-engineering-guide', 'ML', 'shared'];
448
+ let rootIndex = 0;
449
+ for (let i = 0; i < pathParts.length; i++) {
450
+ if (moduleFolders.includes(pathParts[i])) {
451
+ break;
452
+ }
453
+ rootIndex = i + 1;
454
+ }
455
+ basePath = '/' + pathParts.slice(0, rootIndex).join('/');
456
+ if (!basePath.endsWith('/')) basePath += '/';
457
+ }
458
+ }
459
 
460
+ // path starts with /, so remove the leading slash to avoid double slash
461
+ const cleanPath = path.startsWith('/') ? path.substring(1) : path;
462
+ window.location.href = basePath + cleanPath;
463
  }
464
 
465
  /**