hugo-hyperskip

Email-powered static comments for Hugo

git clone git://git.shimmy1996.com/hugo-hyperskip.git

list_comment.html (1035B)

    1 {{ $comments := "" }}
    2 {{ with $.Site.Data.comments.comments }}
    3 {{ $comments = sort (where . "uri" $.Page.RelPermalink) "time" }}
    4 {{ end }}
    5 {{ with $comments }}
    6 {{ range . }}
    7 {{ $timestamp := .time.Format "2006-01-02T15:04:05-07:00" }}
    8 {{ $hash := print .name $timestamp | md5 | last 7 }}
    9 {{ $name := or .name (i18n "hyperskip-name-default") }}
   10 <article id="{{ $hash }}">
   11   <header>
   12     <a href="#{{ $hash }}">{{ $timestamp }}</a>
   13     {{- if not ($.Scratch.Get "is_feed") -}}
   14     &nbsp;|&nbsp;<a href="#comment" onclick="reply({{ $hash }},{{ $name }})">
   15       {{- i18n "hyperskip-reply" -}}
   16     </a>
   17     {{ end }}
   18     <br/>
   19     <b>{{ $name }}</b>&nbsp;
   20     {{- if (strings.HasSuffix ($.Site.Author.email | sha256) .email_hash) -}}
   21     ✦{{ else }}<code>{{ .email_hash | last 4 }}</code>
   22     {{- end -}}
   23   </header>
   24   {{- with (.content | markdownify ) }}
   25   {{ if not ( findRE "<[h|p][^>]*>" . ) }}<p>{{ . }}</p>{{ else }}{{ . }}{{ end }}
   26   {{ end -}}
   27 </article>
   28 {{ end }}
   29 {{ else }}
   30 <p>{{ i18n "hyperskip-placeholder" }}</p>
   31 {{ end }}