|
| 1 | +{% if site.staticman.repository and site.staticman.branch %} |
| 2 | + <div class="page__comments"> |
| 3 | + <!-- Start static comments --> |
| 4 | + <div class="js-comments"> |
| 5 | + {% if site.data.comments[page.slug] %} |
| 6 | + <h3 class="page__comments-title">{{ site.data.ui-text[site.locale].comments_title | default: "Comments" }}</h3> |
| 7 | + {% assign comments = site.data.comments[page.slug] | sort %} |
| 8 | + {% for comment in comments %} |
| 9 | + {% assign email = comment[1].email %} |
| 10 | + {% assign name = comment[1].name %} |
| 11 | + {% assign url = comment[1].url %} |
| 12 | + {% assign date = comment[1].date %} |
| 13 | + {% assign message = comment[1].message %} |
| 14 | + {% include staticman-comment.html index=forloop.index email=email name=name url=url date=date message=message %} |
| 15 | + {% endfor %} |
| 16 | + {% endif %} |
| 17 | + </div> |
| 18 | + <!-- End static comments --> |
| 19 | + <!-- Start new comment form --> |
| 20 | + <div class="page__comments-form"> |
| 21 | + <h3 class="page__comments-title">{{ site.data.ui-text[site.locale].comments_label | default: "Leave a Comment" }}</h3> |
| 22 | + <p class="small">{{ site.data.ui-text[site.locale].comment_form_info | default: "Your email address will not be published. Required fields are marked" }} <span class="required">*</span></p> |
| 23 | + <form id="new_comment" class="page__comments-form js-form form" method="post" action="{{ site.staticman.endpoint | default: 'https://staticman3.herokuapp.com/v3/entry/github/' }}{{ site.staticman.repository }}/{{ site.staticman.branch }}/comments"> |
| 24 | + <div class="form-group"> |
| 25 | + <label for="comment-form-message">{{ site.data.ui-text[site.locale].comment_form_comment_label | default: "Comment" }} <small class="required">*</small></label><br> |
| 26 | + <textarea type="text" rows="12" cols="36" id="comment-form-message" name="fields[message]" tabindex="1"></textarea> |
| 27 | + <div class="small help-block"><a href="https://daringfireball.net/projects/markdown/">{{ site.data.ui-text[site.locale].comment_form_md_info | default: "Markdown is supported." }}</a></div> |
| 28 | + </div> |
| 29 | + <div class="form-group"> |
| 30 | + <label for="comment-form-name">{{ site.data.ui-text[site.locale].comment_form_name_label | default: "Name" }} <small class="required">*</small></label> |
| 31 | + <input type="text" id="comment-form-name" name="fields[name]" tabindex="2" /> |
| 32 | + </div> |
| 33 | + <div class="form-group"> |
| 34 | + <label for="comment-form-email">{{ site.data.ui-text[site.locale].comment_form_email_label | default: "Email address" }} <small class="required">*</small></label> |
| 35 | + <input type="email" id="comment-form-email" name="fields[email]" tabindex="3" /> |
| 36 | + </div> |
| 37 | + <div class="form-group"> |
| 38 | + <label for="comment-form-url">{{ site.data.ui-text[site.locale].comment_form_website_label | default: "Website (optional)" }}</label> |
| 39 | + <input type="url" id="comment-form-url" name="fields[url]" tabindex="4"/> |
| 40 | + </div> |
| 41 | + <div class="form-group hidden" style="display: none;"> |
| 42 | + <input type="hidden" name="options[origin]" value="{{ page.url | absolute_url }}"> |
| 43 | + <input type="hidden" name="options[slug]" value="{{ page.slug }}"> |
| 44 | + <label for="comment-form-location">Not used. Leave blank if you are a human.</label> |
| 45 | + <input type="text" id="comment-form-location" name="fields[hidden]" autocomplete="off"/> |
| 46 | + {% if site.staticman.reCaptcha.siteKey %}<input type="hidden" name="options[reCaptcha][siteKey]" value="{{ site.staticman.reCaptcha.siteKey }}">{% endif %} |
| 47 | + {% if site.staticman.reCaptcha.secret %}<input type="hidden" name="options[reCaptcha][secret]" value="{{ site.staticman.reCaptcha.secret }}">{% endif %} |
| 48 | + </div> |
| 49 | + <!-- Start comment form alert messaging --> |
| 50 | + <p class="hidden js-notice"> |
| 51 | + <strong class="js-notice-text"></strong> |
| 52 | + </p> |
| 53 | + <!-- End comment form alert messaging --> |
| 54 | + {% if site.staticman.reCaptcha.siteKey %} |
| 55 | + <div class="form-group"> |
| 56 | + <div class="g-recaptcha" data-sitekey="{{ site.staticman.reCaptcha.siteKey }}"></div> |
| 57 | + </div> |
| 58 | + {% endif %} |
| 59 | + <div class="form-group"> |
| 60 | + <button type="submit" id="comment-form-submit" tabindex="5" class="btn btn--primary btn--large">{{ site.data.ui-text[site.locale].comment_btn_submit | default: "Submit Comment" }}</button> |
| 61 | + </div> |
| 62 | + </form> |
| 63 | + </div> |
| 64 | + <!-- End new comment form --> |
| 65 | + <!-- Load reCaptcha if site key is set --> |
| 66 | + {% if site.staticman.reCaptcha.siteKey %} |
| 67 | + <script async src="https://www.google.com/recaptcha/api.js"></script> |
| 68 | + {% endif %} |
| 69 | + </div> |
| 70 | + <!-- Load script to handle comment form submission --> |
| 71 | + {% include staticman-script.html %} |
| 72 | +{% endif %} |
0 commit comments