hugo-hyperskip

Email-powered static comments for Hugo

git clone git://git.shimmy1996.com/hugo-hyperskip.git
commit 491c1025f0982eab00c0e6649362a65bde8d0f2f
parent ac06acbaafbb58af45f61fd90b3dac9eeccaaa16
Author: Shimmy Xu <shimmy.xu@shimmy1996.com>
Date:   Sun,  5 Jan 2020 17:16:04 -0600

Switch to use more sematics tags like article instead of div

Other changes:
- Removed <hr> and <br> tags;
- Display only last 4 characters of email hash;
- Display only date of submission.

Diffstat:
Mlayouts/partials/list_comment.html | 39+++++++++++++++++++++------------------
1 file changed, 21 insertions(+), 18 deletions(-)
diff --git a/layouts/partials/list_comment.html b/layouts/partials/list_comment.html
@@ -2,24 +2,27 @@
 {{ range sort (where . "uri" $.Page.RelPermalink) "time" }}
 {{ $timestamp := .time.Format "2006-01-02T15:04:05-07:00" }}
 {{ $hash := print .name $timestamp | md5 | last 7 }}
-<hr/>
-<div id="{{ $hash }}">
-  <b>{{ or .name (i18n "hyperskip-name-default") }}</b>&nbsp;
-  {{- if (strings.HasSuffix ($.Site.Author.email | sha256) .email_hash) -}}
-  ✦
-  {{- else -}}
-  <code>{{ .email_hash | last 10 }}</code>
-  {{- end -}}
-  &nbsp;
-  <span style="float:right;">
-    <a href="#{{ $hash }}">#{{ $hash }}</a>&nbsp;&#91;&nbsp;<a href="#comment" onclick="reply({{ $hash }})">
-      {{- i18n "hyperskip-reply" -}}
-    </a>&nbsp;&#93;
-  </span>
-  <br/>
-  <time datetime={{ $timestamp }}>{{ $timestamp }}</time>
-  <div>{{ .content | htmlEscape | markdownify }}</div>
-</div>
+<article id="{{ $hash }}">
+  <header>
+    <h3>{{ or .name (i18n "hyperskip-name-default") }}&nbsp;
+      {{- if (strings.HasSuffix ($.Site.Author.email | sha256) .email_hash) -}}
+      ✦
+      {{- else -}}
+      <code>{{ .email_hash | last 4 }}</code>
+      {{- end -}}
+    </h3>
+    <nav>
+      <time datetime={{ $timestamp }}>
+        {{- .time.Format "2006-01-02" -}}
+      </time>&nbsp;|&nbsp;<a href="#{{ $hash }}">#
+        {{- $hash -}}
+      </a>&nbsp;|&nbsp;<a href="#comment" onclick="reply({{ $hash }})">
+        {{- i18n "hyperskip-reply" -}}
+      </a>
+    </nav>
+  </header>
+  {{ .content | htmlEscape | markdownify }}
+</article>
 {{ end }}
 <script>
   function reply(hash) {