hugo-hyperskip

Email-powered static comments for Hugo

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

list_comment.html (1184B)

    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 class="e-content top-border" id="{{ $hash }}">
   11   <header>
   12     <nav>
   13       <span class="menu">
   14         <a class="entry" href="#{{ $hash }}">{{ $timestamp }}</a>
   15         <span class="entry"> </span>
   16       </span>
   17       {{- if not ($.Scratch.Get "is_feed") -}}
   18       <a class="menu-right" href="#comment" onclick="reply({{ $hash }},{{ $name }})">
   19         {{- i18n "hyperskip-reply" -}}
   20       </a>
   21     </nav>
   22     {{ end }}
   23     <b>{{ $name }}</b>&nbsp;
   24     {{- if (strings.HasSuffix ($.Site.Author.email | sha256) .email_hash) -}}
   25     ✦{{ else }}<code>{{ .email_hash | last 4 }}</code>
   26     {{- end -}}
   27   </header>
   28   {{- with (.content | markdownify ) }}
   29   {{ if not ( findRE "<[h|p][^>]*>" . ) }}<p>{{ . }}</p>{{ else }}{{ . }}{{ end }}
   30   {{ end -}}
   31 </article>
   32 {{ end }}
   33 {{ else }}
   34 <p>{{ i18n "hyperskip-placeholder" }}</p>
   35 {{ end }}