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

gitlab.com/VincentTam/huginn.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Tam <sere@live.hk>2019-05-19 16:39:52 +0300
committerVincent Tam <sere@live.hk>2019-05-19 16:39:52 +0300
commit2288c393fa07b5cdcb6458bc04696287ea31143e (patch)
treecb7cb9b742c54b152314f1d006cf4e616dcab327 /layouts
parent76f2f554fb905e795da00a54c4b8fb7a5eada207 (diff)
Test Staticman
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/list.html2
-rw-r--r--layouts/_default/single.html9
-rw-r--r--layouts/partials/staticman-comments.html123
3 files changed, 130 insertions, 4 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index dd70f81..c33db04 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -1,7 +1,7 @@
{{ define "main" }}
<header>
<h1>
- <a href="{{ .Page.RSSLink }}"><i class="icon-rss"></i></a>{{ .Title }}
+ <a href="{{ with .OutputFormats.Get "RSS" }}{{ .RelPermalink }}{{ end }}"><i class="icon-rss"></i></a>{{ .Title }}
</h1>
</header>
<ul>
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 69c49f6..47b284c 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -48,7 +48,9 @@
</details>
{{- end -}}
{{- .Content -}}
- {{ partial "gallery" . }}
+ {{- with .Resources.Match "images/gallery/*.*" -}}
+ {{ partial "gallery" . }}
+ {{- end }}
</article>
{{ $related := .Site.RegularPages.Related . | first 5 }}
{{ with $related }}
@@ -59,8 +61,9 @@
{{ end }}
</ul>
{{ end }}
- <form class="js-form form" method="post
-" action="{{ .Site.Params.staticmanapi}}">
+ {{ if .Site.Params.staticman }}
+ {{ partial "staticman-comments.html" . }}
+ {{ end }}
{{ if .Site.Params.comments }}
<script defer data-isso="{{ .Site.Params.isso_server }}"
src="{{ .Site.Params.isso_server }}/js/embed.min.js"
diff --git a/layouts/partials/staticman-comments.html b/layouts/partials/staticman-comments.html
new file mode 100644
index 0000000..2be5b3d
--- /dev/null
+++ b/layouts/partials/staticman-comments.html
@@ -0,0 +1,123 @@
+<section class="js-comments staticman-comments">
+
+ {{ $slug := replace .RelPermalink "/" "" }}
+
+ {{ if .Site.Data.comments }}
+ {{ $comments := index $.Site.Data.comments $slug }}
+ {{ if $comments }}
+ {{ if gt (len $comments) 1 }}
+ <h3>{{ len $comments }} {{ i18n "moreComment" }}</h3>
+ {{ else }}
+ <h3>{{ len $comments }} {{ i18n "oneComment" }}</h3>
+ {{ end }}
+ {{ else }}
+ <h3>{{ i18n "noComment" }}</h3>
+ {{ end }}
+
+ {{ $.Scratch.Set "hasComments" 0 }}
+ {{ range $comments }}
+ {{ if not .replyThread }}
+ {{ $.Scratch.Add "hasComments" 1 }}
+ {{ $.Scratch.Set "hasReplies" 0 }}
+ {{ $.Scratch.Set "threadID" ._id }}
+ <article id="comment-{{ $.Scratch.Get "hasComments" }}" class="static-comment">
+ <img class="comment-avatar" src="https://www.gravatar.com/avatar/{{ .email }}?s=48">
+ {{ if .website }}
+ <h4 class="comment-author"><a rel="external nofollow" href="{{ .website }}">{{ .name }}</a></h4>
+ {{ else }}
+ <h4 class="comment-author">{{ .name }}</h4>
+ {{ end }}
+ <div class="comment-timestamp"><a href="#comment-{{ $.Scratch.Get "hasComments" }}" title="Permalink to this comment"><time datetime="{{ .date }}">{{ dateFormat (default (i18n "shortdateFormat") .Site.Params.dateformat) .date }}</time></a></div>
+ <div class="comment-content"><p>{{ .comment | markdownify }}</p></div>
+ <div class="comment-reply-btn">
+ <a id="{{ ._id }}" class="btn" href="#comment-form" title="{{ ._id }}">{{ i18n "replyToMsg" }}</a>
+ </div>
+ </article>
+
+ {{ range $comments }}
+ {{ if eq .replyThread ($.Scratch.Get "threadID") }}
+ {{ $.Scratch.Add "hasReplies" 1 }}
+ <article id="comment-{{ $.Scratch.Get "hasComments" }}r{{ $.Scratch.Get "hasReplies" }}" class="static-comment static-comment-reply">
+ <img class="comment-avatar" src="https://www.gravatar.com/avatar/{{ .email }}?s=48">
+ {{ if .website }}
+ <h4 class="comment-author"><a rel="external nofollow" href="{{ .website }}">{{ .name }}</a></h4>
+ {{ else }}
+ <h4 class="comment-author">{{ .name }}</h4>
+ {{ end }}
+ <h5 class="comment-reply-target"><a href="#{{ .replyID }}"><i class="fas fa-reply"></i> {{ .replyName }}</a></h5>
+ <div class="comment-timestamp"><a href="#comment-{{ $.Scratch.Get "hasComments" }}r{{ $.Scratch.Get "hasReplies" }}" title="Permalink to this comment"><time datetime="{{ .date }}">{{ dateFormat (default (i18n "shortdateFormat") .Site.Params.dateformat) .date }}</time></a></div>
+ <div class="comment-content"><p>{{ .comment | markdownify }}</p></div>
+ <div class="comment-reply-btn">
+ <a id="{{ ._id }}" class="btn" href="#comment-form" title="{{ $.Scratch.Get "threadID" }}">{{ i18n "replyToMsg" }}</a>
+ </div>
+ </article>
+ {{ end }}
+ {{ end }}
+ {{ end }}
+ {{ end }}
+ {{ end }}
+
+
+
+<form id="comment-form" class="js-form form" method="post" action="{{ .Site.Params.staticman.api }}">
+ <input type="hidden" name="options[slug]" value="{{ replace .RelPermalink "/" "" }}">
+ <input type="hidden" name="options[parent]" value="">
+ <input type="hidden" name="fields[replyThread]" value="">
+ <input type="hidden" name="fields[replyID]" value="">
+ <input type="hidden" name="fields[replyName]" value="">
+
+ {{ if .Site.Params.staticman.recaptcha }}
+ <input type="hidden" name="options[reCaptcha][siteKey]" value="{{ .Site.Params.staticman.recaptcha.sitekey }}">
+ <input type="hidden" name="options[reCaptcha][secret]" value="{{ .Site.Params.staticman.recaptcha.secret }}">
+ {{ end }}
+
+ <fieldset>
+ <div class="textfield">
+ <textarea name="fields[comment]" placeholder="{{ i18n "useMarkdown" }}"></textarea>
+ </div>
+ </fieldset>
+
+ <fieldset>
+ <div class="textfield">
+ <input name="fields[name]" type="text" placeholder="{{ i18n "yourName" }}"/>
+ </div>
+ </fieldset>
+
+ <fieldset>
+ <div class="textfield">
+ <input type="email" name="fields[email]" placeholder="{{ i18n "yourEmail" }}"/>
+ </div>
+ </fieldset>
+
+ <fieldset>
+ <div class="textfield">
+ <input type="text" name="fields[website]" placeholder="{{ i18n "yourWebsite" }}"/>
+ </div>
+ </fieldset>
+
+ {{ if .Site.Params.staticman.recaptcha }}
+ <fieldset>
+ <div class="g-recaptcha" data-sitekey="{{ .Site.Params.staticman.recaptcha.sitekey }}"></div>
+ </fieldset>
+ {{ end }}
+
+ <fieldset>
+ <button type="submit" class="button">
+ Submit
+ </button>
+ <button type="reset" value="Reset">
+ Reset
+ </button>
+ </fieldset>
+</form>
+</section>
+
+<article class="modal">
+ <div class="title">
+ <h2 class="js-modal-title"></h2>
+ </div>
+ <div class="js-modal-text"></div>
+ <div>
+ <button class="js-close-modal">Close</button>
+ </div>
+</article>