|
1 | | -<!-- Hi. --> |
| 1 | +<!-- So. Many. Websites. --> |
2 | 2 | <!DOCTYPE html> |
3 | | -<html lang="en" data-theme="light" class={{templateClass}}> |
| 3 | +<html lang="en" class={{templateClass}}> |
4 | 4 | <head> |
5 | 5 | <meta charset="utf-8"> |
6 | 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover, maximum-scale=1"> |
|
31 | 31 | </style> |
32 | 32 | </head> |
33 | 33 | <body> |
34 | | - <nav class="sidebar"> |
35 | | - <a href="/" class="sidebar-link"> |
36 | | - <svg class="sidebar-logo" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.dev/svgjs" width="36" height="37"><svg width="36" height="37" viewBox="0 0 36 37" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 34 | + <nav class="sidebar sidebar-main"> |
| 35 | + <a href="{% if page.url == '/table-of-contents/' %}/{% else %}/table-of-contents/{% endif %}" class="sidebar-link"> |
| 36 | + <svg id="logo" class="sidebar-logo" xmlns="http://www.w3.org/2000/svg" version="1.1" width="36" height="37" viewBox="0 0 36 37" fill="none"> |
37 | 37 | <path d="M35.2 18.1992C35.2 8.69992 27.4993 0.999219 18 0.999219C8.5007 0.999219 0.8 8.69992 0.8 18.1992C0.8 27.6985 8.5007 35.3992 18 35.3992C27.4993 35.3992 35.2 27.6985 35.2 18.1992Z" fill="white"></path> |
38 | 38 | <path fill-rule="evenodd" clip-rule="evenodd" d="M18 1.79922C8.94253 1.79922 1.6 9.14175 1.6 18.1992C1.6 27.2567 8.94253 34.5992 18 34.5992C27.0575 34.5992 34.4 27.2567 34.4 18.1992C34.4 9.14175 27.0575 1.79922 18 1.79922ZM0 18.1992C0 8.25809 8.05887 0.199219 18 0.199219C27.9411 0.199219 36 8.25809 36 18.1992C36 28.1403 27.9411 36.1992 18 36.1992C8.05887 36.1992 0 28.1403 0 18.1992Z" fill="black"></path> |
39 | 39 | <path d="M31.1243 28.6702C30.5574 25.4791 29.1972 22.4986 27.2238 20.0084C27.2957 19.7203 27.3677 19.4323 27.4399 19.1445C28.8799 19.0726 30.3199 17.9926 30.3199 17.7045C30.3199 17.4165 29.0238 15.9764 27.5838 15.6884C27.4399 14.3923 27.0077 13.1684 26.3599 12.0884C24.8479 9.35227 22.0399 7.40839 18.6559 7.04839C16.2798 6.83229 13.9759 7.33644 12.1759 8.63227C9.79977 10.2884 6.63201 14.8963 6.63201 14.8963L0.636454 22.5591C2.68757 29.734 9.46072 35 17.5 35C19.0071 35 20.4696 34.8149 21.865 34.4669C18.7567 31.4382 15.9198 28.5769 15.9198 28.5769C12.1037 24.6888 12.0317 18.5689 15.6317 14.7529C17.5756 12.6648 20.0956 11.5848 22.9037 11.5848C23.3357 11.5848 23.8399 11.5848 24.2718 11.6568C24.5598 12.0168 24.8479 12.4487 25.0637 12.8807L25.2076 13.0968C25.9996 14.6087 26.2876 16.2648 26.1438 17.9206C26.0721 18.4943 25.9289 19.0676 25.7856 19.6413L25.7838 19.6487L25.5677 20.3687L26.0716 20.9448C28.2099 23.6044 29.4793 26.755 29.8252 30.0684C30.2841 29.6261 30.7179 29.1593 31.1243 28.6702Z" fill="black"></path> |
40 | 40 | <path d="M20.7437 17.7045C21.3006 17.7045 21.7518 17.2533 21.7518 16.6967C21.7518 16.1398 21.3006 15.6886 20.7437 15.6886C20.1871 15.6886 19.7359 16.1398 19.7359 16.6967C19.7359 17.2533 20.1871 17.7045 20.7437 17.7045Z" fill="black"></path> |
41 | 41 | </svg> |
42 | 42 | <div class="sidebar-title"> |
43 | | - {{ title }} |
| 43 | + {% if page.url == '/table-of-contents/' %} |
| 44 | + Notes from the Field |
| 45 | + {% else %} |
| 46 | + {{ title }} |
| 47 | + {% endif %} |
44 | 48 | </div> |
45 | 49 | <div class="sidebar-name">◆</div> |
46 | 50 | </a> |
|
61 | 65 |
|
62 | 66 | const loader = document.getElementById('infinite-scroll-loader'); |
63 | 67 | const pageContent = document.querySelector('page-content'); |
| 68 | + const isHomepage = window.location.pathname === '/'; |
64 | 69 |
|
65 | 70 | let isLoading = false; |
66 | 71 | let loadedUrls = new Set([firstArticle.dataset.url]); |
|
100 | 105 | pageContent.appendChild(newArticle); |
101 | 106 | currentArticle = newArticle; |
102 | 107 |
|
103 | | - // Update URL without page reload |
104 | | - history.pushState({ url: nextUrl }, '', nextUrl); |
105 | | -
|
106 | | - // Update page title |
107 | | - const newTitle = doc.querySelector('title').textContent; |
108 | | - document.title = newTitle; |
| 108 | + // If on homepage, wrap h1 in a link |
| 109 | + if (isHomepage) { |
| 110 | + const h1 = newArticle.querySelector('h1'); |
| 111 | + if (h1 && !h1.querySelector('a')) { |
| 112 | + const link = document.createElement('a'); |
| 113 | + link.href = nextUrl; |
| 114 | + link.textContent = h1.textContent; |
| 115 | + h1.textContent = ''; |
| 116 | + h1.appendChild(link); |
| 117 | + } |
| 118 | + } |
109 | 119 |
|
110 | | - // Update sidebar title |
111 | | - const sidebarTitle = document.querySelector('.sidebar-title'); |
112 | | - const newH1 = newArticle.querySelector('h1'); |
113 | | - if (sidebarTitle && newH1) { |
114 | | - sidebarTitle.textContent = newH1.textContent; |
| 120 | + // Only update URL and title if not on homepage |
| 121 | + if (!isHomepage) { |
| 122 | + // Update URL without page reload |
| 123 | + history.pushState({ url: nextUrl }, '', nextUrl); |
| 124 | +
|
| 125 | + // Update page title |
| 126 | + const newTitle = doc.querySelector('title').textContent; |
| 127 | + document.title = newTitle; |
| 128 | +
|
| 129 | + // Update sidebar title |
| 130 | + const sidebarTitle = document.querySelector('.sidebar-title'); |
| 131 | + const newH1 = newArticle.querySelector('h1'); |
| 132 | + if (sidebarTitle && newH1) { |
| 133 | + sidebarTitle.textContent = newH1.textContent; |
| 134 | + } |
115 | 135 | } |
116 | 136 | } |
117 | 137 | } catch (error) { |
|
141 | 161 | }, 100); |
142 | 162 | }, { passive: true }); |
143 | 163 |
|
144 | | - // Handle browser back/forward buttons |
145 | | - window.addEventListener('popstate', (event) => { |
146 | | - if (event.state && event.state.url) { |
147 | | - window.location.href = event.state.url; |
148 | | - } |
149 | | - }); |
| 164 | + // Handle browser back/forward buttons (only if not homepage) |
| 165 | + if (!isHomepage) { |
| 166 | + window.addEventListener('popstate', (event) => { |
| 167 | + if (event.state && event.state.url) { |
| 168 | + window.location.href = event.state.url; |
| 169 | + } |
| 170 | + }); |
150 | 171 |
|
151 | | - // Initial state |
152 | | - history.replaceState({ url: firstArticle.dataset.url }, '', firstArticle.dataset.url); |
| 172 | + // Initial state |
| 173 | + history.replaceState({ url: firstArticle.dataset.url }, '', firstArticle.dataset.url); |
| 174 | + } |
153 | 175 | })(); |
154 | 176 | </script> |
155 | 177 | </body> |
|
0 commit comments