11const createFooter = ( ) => {
22 const year = new Date ( ) . getFullYear ( ) ;
3+ const pagePath = ( page ) => {
4+ const isLocalPreview = window . location . protocol === 'file:' ||
5+ [ 'localhost' , '127.0.0.1' , '' ] . includes ( window . location . hostname ) ;
6+ const cleanPath = page === 'index' ? '/' : `/${ page } ` ;
7+ const htmlPath = `${ page } .html` ;
8+
9+ return isLocalPreview ? htmlPath : cleanPath ;
10+ } ;
311
412 const footerHTML = `
513 <footer class="main-footer">
614 <div class="footer-container">
715 <!-- Brand Section -->
816 <div class="footer-brand">
9- <a href="index.html " class="logo" aria-label="BiblioDrift Home">
17+ <a href="${ pagePath ( ' index' ) } " class="logo" aria-label="BiblioDrift Home">
1018 <img class="footer-logo" src="../assets/images/biblioDrift_favicon.png" alt="BiblioDrift Logo"> BiblioDrift
1119 </a>
1220 <p class="footer-tagline">"There is no frigate like a book to take us lands away."</p>
@@ -17,23 +25,24 @@ const createFooter = () => {
1725 <nav class="footer-nav" aria-label="Footer Navigation">
1826 <h3>Explore</h3>
1927 <ul>
20- <li><a href="index.html ">Discovery</a></li>
21- <li><a href="vault.html ">My Vault</a></li>
22- <li><a href="library.html ">My Library</a></li>
23- <li><a href="chat.html ">Literary Chat</a></li>
24- <li><a href="auth.html ">Account</a></li>
28+ <li><a href="${ pagePath ( ' index' ) } ">Discovery</a></li>
29+ <li><a href="${ pagePath ( ' vault' ) } ">My Vault</a></li>
30+ <li><a href="${ pagePath ( ' library' ) } ">My Library</a></li>
31+ <li><a href="${ pagePath ( ' chat' ) } ">Literary Chat</a></li>
32+ <li><a href="${ pagePath ( ' auth' ) } ">Account</a></li>
2533 <li>
26- <a href="https://github.com/devanshi14malhotra/BiblioDrift" target="_blank">
27- Repository
28- </a>
29- </ul>
34+ <a href="https://github.com/devanshi14malhotra/BiblioDrift" target="_blank" rel="noopener noreferrer">
35+ Repository
36+ </a>
37+ </li>
38+ </ul>
3039 </nav>
3140
3241 <div class="footer-legal">
3342 <h3>Legal</h3>
3443 <ul>
35- <li><a href="privacy-policy.html ">Privacy Policy</a></li>
36- <li><a href="terms-and-conditions.html ">Terms & Conditions</a></li>
44+ <li><a href="${ pagePath ( ' privacy-policy' ) } ">Privacy Policy</a></li>
45+ <li><a href="${ pagePath ( ' terms-and-conditions' ) } ">Terms & Conditions</a></li>
3746 </ul>
3847 </div>
3948
0 commit comments