This repository has been archived by the owner on Sep 12, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Let's see if this works
- Loading branch information
Showing
7 changed files
with
153 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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.
49 changes: 49 additions & 0 deletions
49
themes/beautifulhugo/layouts/partials/staticman_post_comment.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters