Browse Source

fix(help): change 404 page to error page and improve script perf

fixes #43
Josh Habdas 1 year ago
parent
commit
9749575eb3
Signed by: Josh Habdas <jhabdas@protonmail.com> GPG Key ID: B148B31154C75A74
2 changed files with 12 additions and 12 deletions
  1. 1
    1
      README.md
  2. 11
    11
      layouts/partials/toc-maybe.html

+ 1
- 1
README.md View File

@@ -48,7 +48,7 @@ Referrer Policy | Help protect your visitors from nosy neighbors with a simple s
48 48
 Snippets | Display alerts, cards, progress indicators and easily build great-looking forms.
49 49
 Related Content | Display links to relevant content below blog posts automatically.
50 50
 Table of Contents | Create collapsable content summaries with deep link and smooth-scroll support.
51
-404 Page | Entertain users into staying when they experience linkrot on your site.
51
+Error Page | Entertain users when errors occur by giving them a glimpse inside the machine.
52 52
 </details>
53 53
 
54 54
 ## Getting Started

+ 11
- 11
layouts/partials/toc-maybe.html View File

@@ -1,4 +1,4 @@
1
-{{ if and (isset .Params "toc") .Params.toc  }}
1
+{{ if and (isset .Params "toc") .Params.toc }}
2 2
   <details>
3 3
     <summary>Table of Contents</summary>
4 4
     {{ .TableOfContents }}
@@ -9,17 +9,17 @@
9 9
       el.onclick = () => {
10 10
         fetchInject([{{ "/js/smoothscroll.js" | relURL }}]);
11 11
         el.onclick = null;
12
-      };
13
-      document.querySelectorAll('#TableOfContents a').forEach(link => {
14
-        link.addEventListener('click', (evt) => {
15
-          evt.preventDefault();
16
-          const selector = link.href.slice(link.href.indexOf('#'));
17
-          document.querySelector(
18
-            selector
19
-          ).scrollIntoView({ behavior: 'smooth' });
20
-          window.history.pushState({}, "", selector);
12
+        document.querySelectorAll('#TableOfContents a').forEach(link => {
13
+          link.addEventListener('click', evt => {
14
+            evt.preventDefault();
15
+            const selector = link.href.slice(link.href.indexOf('#'));
16
+            document.querySelector(
17
+              selector
18
+            ).scrollIntoView({ behavior: 'smooth' });
19
+            window.history.pushState({}, "", selector);
20
+          });
21 21
         });
22
-      });
22
+      };
23 23
     })(window, document);
24 24
   </script>
25 25
 {{ end }}

Loading…
Cancel
Save