Welcome to mirror list, hosted at ThFree Co, Russian Federation.

staticman.html « post « layouts - github.com/jpescador/hugo-future-imperfect.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 955846b41030945e2b8805a36a7b96ee3f849cb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<h2>Say something</h2>
{{ with .Site.Params.staticman }}
  <form class="post-new-comment" method="POST" action="https://dev.staticman.net/v2/entry/{{ .username }}/{{ .repo }}/{{ .branch }}/comments">
{{ end }}
    <input type="hidden" name="options[redirect]" value="{{ .Permalink }}">
    <input type="hidden" name="options[entryId]" value="{{ .UniqueID }}">
    <input required name="fields[name]" type="text" placeholder="Your name (Required)">
    <input name="fields[website]" type="text" placeholder="Your website">
    <input required name="fields[email]" type="email" placeholder="Your email address (Required for Gravatar)">
    <textarea required name="fields[body]" placeholder='Your message. Feel free to use Markdown (Google "Markdown Cheat Sheet").' rows="10"></textarea>
    <input type="hidden" name="options[reCaptcha][siteKey]" value="6LeoGzAUAAAAAEQyc2O1okFJPFsYFgryXvpLkFJ1">
    <input type="hidden" name="options[reCaptcha][secret]" value="A2bqZay+pf0qOpY/GARlzqV7Bq9U4JzQhipNYlh44Zd7+aGYFc+5hArV5zVXl1tVHtPPL/o1BCDhy6EKiBP8eupxN4o1ISpbk5bpREJTPVgA+zSDiPmfJ4U6JNjmp752gjLcv4JOvJYzNeRnu23ZjjbT497f5EIdWRGBJGa/OHA=">
    <div class="g-recaptcha" data-sitekey="6LeoGzAUAAAAAEQyc2O1okFJPFsYFgryXvpLkFJ1"></div>
    <input type="submit" value="Submit">
  </form>
<script src='https://www.google.com/recaptcha/api.js'></script>

<h2>Comments</h2>

{{ $comments := readDir "data/comments" }}
{{ $.Scratch.Add "hasComments" 0 }}
{{ $entryId := .UniqueID }}

{{ range $comments }}
  {{ if eq .Name $entryId }}
    {{ $.Scratch.Add "hasComments" 1 }}
    {{ range $index, $comments := (index $.Site.Data.comments $entryId ) }}
    <article id="{{ .uniqueID }}" class="post-comment">
      <img class="post-comment-avatar" src="https://www.gravatar.com/avatar/{{ .email }}?s=100">
      <h3 class="post-comment-author">
        <a rel="external nofollow" href="{{ .website }}">{{ .name }}</a>
      </h3>
      <div class="post-comment-timestamp">
        <a href="#{{ .uniqueID }}" title="Permalink to this comment">
          <time datetime="{{ .date }}">{{ dateFormat "02/01/2006" .date }}</time>
        </a>
      </div>
      <div class="post-comment-content">
        {{ .body | markdownify }}
      </div>
    </article>
    {{ end }}
{{ end }}
{{ end }}

{{ if eq ($.Scratch.Get "hasComments") 0 }}
  <p>Nothing yet.</p>
{{ end }}