Permalink
Browse files

Let's see if this works

  • Loading branch information...
romatik committed Nov 4, 2018
1 parent 97eea48 commit 3425f2c7fd25200986df7b8207d52cea3f34cb07
@@ -24,6 +24,7 @@ ignoreFiles = ["\\.Rmd$", "\\.Rmarkdown$", "_files$", "_cache$"]
commit = false
rss = true
comments = true
staticman_api = "https://staticmanforromatik.herokuapp.com/v3/entry/romatik/netlify-blog/master/comments"

# Set up your menu items in the navigation bar
# You can use identifier to prepend a font awesome icon to your text
@@ -0,0 +1,25 @@
# Name of the property. You can have multiple properties with completely
# different config blocks for different sections of your site.
# For example, you can have one property to handle comment submission and
# another one to handle posts.
comments:
allowedFields: ["path", "name", "email", "message"]
allowedOrigins: ["localhost", "www.mishabalyasin.com"]
commitMessage: "You have a new comment on your website."
branch: "master"
generatedFields:
date:
type: date
options:
format: "iso8601"
format: "yml"
moderation: true
notifications:
enabled: false
name: "www.mishabalyasin.com"
path: "data/comments"
filename: "{fields.date}_{@id}"
requiredFields: ["path", "name", "email", "message"]
transforms:
body: "frontmatterContent"
email: md5
@@ -22,7 +22,7 @@
{{ if (.Params.comments) | or (and (or (not (isset .Params "comments")) (eq .Params.comments nil)) (.Site.Params.comments)) }}
{{ if .Site.DisqusShortname }}
<div class="disqus-comments">
{{ template "_internal/disqus.html" . }}
{{ template "_internal/comments.html" . }}
</div>
{{ end }}
{{ end }}
@@ -0,0 +1,3 @@
{{ if and (ge (len .Site.Params.staticman_api) 1) (not (or .Site.Params.disable_comments .Params.disable_comments)) (not .Site.IsServer) }}
{{ template "partials/staticman_post_comment.html" . }}
{{ end }}

This file was deleted.

Oops, something went wrong.
@@ -0,0 +1,49 @@
<section class="post-comments">
<h2>Comments</h2>
{{ $mycomments := .Site.Data.comments }}

{{ $.Scratch.Add "hasComments" 0 }}

{{ range $mycomments }}
<!--{{ printf "%#v" $.File.Path }}-->
{{ if in .path $.File.Path }}
{{ $.Scratch.Add "hasComments" 1 }}
<div class="post-comment">
<div class="post-comment-header">
<img class="post-comment-avatar" src="https://www.gravatar.com/avatar/{{ .email }}?s=40">
<p class="post-comment-info"><strong>{{ .name }}</strong><br>{{ dateFormat "02 Jan 06 15:04 MST" .date }}</p>
</div>
{{ .message | markdownify }}
</div>
{{ end }}
{{ end }}

{{ if eq ($.Scratch.Get "hasComments") 0 }}
<p>There aren't any comments yet. Be the first to comment!</p>
{{ end }}

<h3 style = "margin-top:20px">Leave a comment</h3>

<form class="post-comment" method="POST" action="{{ .Site.Params.staticman_api }}">
<input type="hidden" name="options[redirect]" value="{{ .Permalink }}#comment-submitted">
<input type="hidden" name="options[redirectError]" value="{{ .Permalink }}#post-error">
<input type="hidden" name="options[entryId]" value="{{ .UniqueID }}">
<input name="fields[path]" type="hidden" value="{{ .File.Path }}">
<input name="fields[name]" type="text" class="post-comment-field" placeholder="Your name">
<input name="fields[email]" type="email" class="post-comment-field" placeholder="Your email address">
<textarea name="fields[message]" class="post-comment-field" placeholder="Your message. Feel free to use Markdown." rows="3"></textarea>
<input type="submit" class="post-comment-field btn" value="Submit">
</form>
</section>

<div id="comment-submitted" class="dialog">
<h3>Thank you</h3>
<p>Your comment has been submitted and will be published once it has been approved.</p>
<p><a href="" class="btn">OK</a></p>
</div>

<div id="post-error" class="dialog">
<h3>Sorry</h3>
<p>Your post has not been submitted. Please return to the form and make sure that all fields are entered. Thank You!</p>
<p><a href="" class="btn">OK</a></p>
</div>
@@ -707,3 +707,77 @@ input.gsc-input, .gsc-input-box, .gsc-input-box-hover, .gsc-input-box-focus, .gs
box-sizing: content-box;
line-height: normal;
}

/* css for staticman */
.highlighttable td,th{padding:0;border:0;}td.code{width:95%;}

.post-comments {
margin-top: 60px;
}

.post-comment {
background-color: #eee;
padding: 20px;
margin-top: 20px;
}

.post-comment-header {
margin-bottom: 20px;
}

.post-comment-avatar {
display: inline-block;
vertical-align: middle;
border-radius: 50%;
}

.post-comment-info {
display: inline-block;
margin-left: 20px;
margin-bottom: 0;
vertical-align: middle;
}

.post-comment-field {
display: block;
font: inherit;
padding: 10px;
margin-top: 20px;
outline-color: #F76C5E;
width: 100%;
}

.btn {
border: 2px solid #F76C5E;
background-color: #F76C5E;
color: white;
display: inline-block;
font: inherit;
padding: 20px;
min-width: 100px;
-webkit-appearance: none;
}

.btn:hover {
border: 2px solid #F76C5E !important;
background-color: white;
color: #F76C5E;
text-decoration: none;
}

.dialog {
display: none;
position: fixed;
background-color: rgba(238, 238, 238, 1);
padding: 25px;
padding-top: 20%;
top: 0;
left: 0;
width: 100%;
height: 100%;
text-align: center;
}

.dialog:target {
display: block;
}

0 comments on commit 3425f2c

Please sign in to comment.