🐙 Templated web page generator for your git repositories
git clone https://github.com/m-col/gitja
Files | Refs | Readme | License

Commit afedb32fd8d5e3134b4f9f05b78779bd4b7c2e27
Parent: 33e1a764b90ab2413989896c072e1c3e63a83308
Author: mcol <mcol@posteo.net>
Date: 2021-12-02 00:22:34 +0000
Committer: mcol <mcol@posteo.net>
Committed: 2021-12-02 00:22:34 +0000

Add commit.href, use it to show commit used to generate docs

Closes #18

templates/docs/template.html.include Modified

@@ -28,6 +28,10 @@
         <a href="{{ host }}/{{ name }}/file/{{ readme.href }}">Readme</a> |
         <a href="{{ host }}/{{ name }}/file/{{ license.href }}">License</a>
       </span>
+
+      <p id="tag">
+        Docs built @ <a href="{{ host }}/gitserve/commit/{{ commits[0].href }}">{{ commits[0].id[:7] }}</a>
+      </p>
     </div>
 
     <div id="content">

templates/docs/style.css Modified

@@ -47,6 +47,11 @@
     padding: 10px 20px 0;
 }
 
+#tag,
+#tag a {
+    color: #aaa;
+}
+
 #links {
     float: right;
 }

src/Types.hs Modified

@@ -89,6 +89,7 @@
 commitAsLookup :: Commit LgRepo -> Text -> Maybe (GVal m)
 commitAsLookup commit = \case
     "id" -> Just . toGVal . show . untag . commitOid $ commit
+    "href" -> Just . toGVal . (<> ".html") . show . untag . commitOid $ commit
     "title" -> Just . toGVal . strip . T.takeWhile (/= '\n') . commitLog $ commit
     "body" -> Just . toGVal . strip . T.dropWhile (/= '\n') . commitLog $ commit
     "message" -> Just . toGVal . strip . commitLog $ commit

DOCUMENTATION.md Modified

@@ -162,6 +162,7 @@
 |            | head             | The current git commit.                                  |
 |            | updated          | The time when the current commit was committed.          |
 | commit     | id               | The SHA of the given commit.                             |
+|            | href             | The name of the HTML file for this commit.               |
 |            | title            | The commit message title.                                |
 |            | body             | The commit message body.                                 |
 |            | message          | The entire message, including both title and body.       |
@@ -175,7 +176,7 @@
 |            | parent           | The SHA of the parent commit.                            |
 | file       | path             | The path the file relative to the repository root.       |
 |            | name             | The name of the file.                                    |
-|            | href             | The HTML output path relative to `outputDirectory`.      |
+|            | href             | The name of the HTML file for this file.                 |
 |            | contents         | The file's contents.                                     |
 |            | mode             | Directory, Plain, Executable, Symlink or Submodule.      |
 |            | mode\_octal      | Mode in octal form e.g. "00644" for plain files.         |