1
0
mirror of https://github.com/avinal/avinal.github.io.git synced 2026-07-04 07:40:09 +05:30

comment system added

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
This commit is contained in:
2021-05-31 00:07:03 +05:30
parent 20a0244bae
commit 03cfbdc9b9
2 changed files with 57 additions and 17 deletions
+12
View File
@@ -62,3 +62,15 @@ SITEMAP_SAVE_AS = 'sitemap.xml'
DEFAULT_PAGINATION = 5
PYGMENTS_STYLE = 'manni'
# Comments config
FORM_COMMENTS = True
FORM_PROPERTIES = {
'name' : 'entry.982725972',
'email':'entry.1652853191',
'link':'entry.1641222305',
'comment':'entry.1062656232',
'action':'https://docs.google.com/forms/u/0/d/e/1FAIpQLSfL9T8WBRm-Ac2uyu74lJXSYOqAuF6lLIUAulRArCsuiI1ZRQ/formResponse'
}
+45 -17
View File
@@ -1,21 +1,49 @@
{% if DISQUS_SITENAME %}
<hr>
<div id="disqus_thread"></div>
{% if FORM_COMMENTS %}
<div id="comment-form">
<div class="alert alert-info" role="alert">
Feel free to leave a feedback or questions !
</div>
<form id="comment-form" action="{{ FORM_PROPERTIES['action'] }}" target="response" method="POST">
<div class="form-row align-items-center">
<div class="form-group col-auto">
<label class="sr-only" for="person-name">Name</label>
<input type="text" class="form-control form-control-sm" id="person-name" placeholder="Your Name (Optional)"
aria-describedby="nameHelp" name="{{ FORM_PROPERTIES['name'] }}">
<input type="text" id="page-link" name="{{ FORM_PROPERTIES['link'] }}" hidden>
<small id="nameHelp" class="form-text text-muted">You may put your GitHub Username.</small>
</div>
<div class="form-group col">
<label class="sr-only" for="email-address">Email address</label>
<input type="email" class="form-control form-control-sm" id="email-address" aria-describedby="emailHelp"
placeholder="Your Email Address (Optional)" name="{{ FORM_PROPERTIES['email'] }}">
<small id="emailHelp" class="form-text text-muted">I'll never share your email with anyone
else.</small>
</div>
</div>
<div class="form-group">
<label class="sr-only" for="comment-section">Your Message</label>
<textarea class="form-control form-control-sm" id="comment-section" rows="3"
placeholder="Please enter your message or feedback. (Required)" aria-describedby="emailHelp"
name="{{ FORM_PROPERTIES['comment'] }}" required></textarea>
<small id="textHelp" class="form-text text-muted">Enter upto 200 characters.</small>
</div>
<button class="btn btn-outline-info" onclick="return submitform()" type="submit">Send</button>
</form>
<iframe name="response" hidden></iframe>
</div>
<div class="alert alert-info" role="alert" id="comment-message" style="display: none;">
<h4 class="alert-heading">Thanks You 🥳</h4>
<p>Thanks a lot for reading this blog and sending me a feedback. I hope you liked it. I will get back to you
soon if you have added an email.</p>
</div>
<script>
var disqus_config = function () {
this.page.url = '{{ SITEURL }}/{{ output_file }}';
this.page.identifier = '{{ article.slug }}';
function submitform() {
var form = document.getElementById('comment-form');
document.getElementById('page-link').value = window.location.href;
form.style.display = 'none';
document.getElementById('comment-message').style.display = '';
var submitted = form.submit();
return false;
};
(function () {
var d = document;
var s = d.createElement('script');
s.src = '//{{ DISQUS_SITENAME }}.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript class="text-muted">
Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by
Disqus.</a>
</noscript>
{% endif %}