]> git.ardis.lu - ardislu.dev/commitdiff
Add edit button to articles
authorArdis Lu <ardisglu@gmail.com>
Mon, 27 Sep 2021 06:45:34 +0000 (23:45 -0700)
committerArdis Lu <ardisglu@gmail.com>
Mon, 27 Sep 2021 06:45:34 +0000 (23:45 -0700)
404.html
pencil.svg [new file with mode: 0644]

index 61e244b5f256b34606f5d2a7be13ab5c72ea6735..559bb7effb878a369841d0ebbdfc594ccdca1783 100644 (file)
--- a/404.html
+++ b/404.html
@@ -16,6 +16,9 @@
     <a href="/">
       <img src="/home.svg" width="24" height="24" alt="Home" />
     </a>
+    <a id="edit">
+      <img src="/pencil.svg" width="24" height="24" alt="Edit this article" />
+    </a>
   </header>
   <main>
     <article class="post"></article>
@@ -54,6 +57,7 @@
       const proxyUrl = 'https://script.google.com/macros/s/AKfycbzMHxwypbwsccBq6RH8LDCAOpM02C4gbkljbcKHKFsoQTRE-f4XTIyswiaO0vshs-Kr/exec';
       const documentId = window.location.pathname.split('/').pop();
       const url = `${proxyUrl}?https://docs.googleapis.com/v1/documents/${documentId}`;
+      document.getElementById('edit').setAttribute('href', `https://docs.google.com/document/d/${documentId}/edit`);
 
       await fetch(url)
         .then((httpResponse) => httpResponse.json())
diff --git a/pencil.svg b/pencil.svg
new file mode 100644 (file)
index 0000000..768af96
--- /dev/null
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M14.06 9.02l.92.92L5.92 19H5v-.92l9.06-9.06M17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29zm-3.6 3.19L3 17.25V21h3.75L17.81 9.94l-3.75-3.75z"/></svg>
\ No newline at end of file
This page took 0.040296 seconds and 4 git commands to generate.