commit fd18479a6052eb9675a70e92c949bd1c33132d91
parent ee6768cb08b414a9fc71b0dac69a5a615fc625e6
Author: Shimmy Xu <shimmy.xu@shimmy1996.com>
Date: Tue, 7 Jan 2020 20:08:24 -0600
Add feed specific partial template
Diffstat:
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/layouts/partials/comment_form.html b/layouts/partials/comment_form.html
@@ -13,3 +13,8 @@
placeholder="{{ i18n "hyperskip-requirement"}}"></textarea><br/>
<input type="submit" value="{{ i18n "hyperskip-submit"}}">
</form>
+<script>
+ function reply(hash) {
+ document.forms.comment_form.comment.value += "[>>" + hash + "](#" + hash + ")\n";
+ }
+</script>
diff --git a/layouts/partials/hyperskip_feed.html b/layouts/partials/hyperskip_feed.html
@@ -0,0 +1,3 @@
+<h2>{{ i18n "hyperskip-header" }}</h2>
+{{ .Scratch.Set "is_feed" true }}
+{{ partial "list_comment.html" . }}
diff --git a/layouts/partials/list_comment.html b/layouts/partials/list_comment.html
@@ -1,5 +1,5 @@
{{ $comments := "" }}
-{{ with .Site.Data.comments.comments }}
+{{ with $.Site.Data.comments.comments }}
{{ $comments = sort (where . "uri" $.Page.RelPermalink) "time" }}
{{ end }}
{{ with $comments }}
@@ -15,6 +15,7 @@
<code>{{ .email_hash | last 4 }}</code>
{{- end -}}
</h3>
+ {{ if not ($.Scratch.Get "is_feed") }}
<nav>
{{- .time.Format "2006-01-02" -}}
| <a href="#{{ $hash }}">#
@@ -23,15 +24,11 @@
{{- i18n "hyperskip-reply" -}}
</a>
</nav>
+ {{ end }}
</header>
{{ .content | htmlEscape | markdownify }}
</article>
{{ end }}
-<script>
- function reply(hash) {
- document.forms.comment_form.comment.value += "[>>" + hash + "](#" + hash + ")\n";
- }
-</script>
{{ else }}
<p>{{ i18n "hyperskip-placeholder" }}</p>
{{ end }}