forked from alshedivat/al-folio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for giscus comments (alshedivat#1028)
adds support for comments on posts using https://giscus.app/
- Loading branch information
1 parent
2fe2a1e
commit 6cc1dd7
Showing
10 changed files
with
118 additions
and
43 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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<div id="disqus_thread" style="max-width: {{ site.max_width }}; margin: 0 auto;"> | ||
<script type="text/javascript"> | ||
var disqus_shortname = '{{ site.disqus_shortname }}'; | ||
var disqus_identifier = '{{ page.id }}'; | ||
var disqus_title = {{ page.title | jsonify }}; | ||
(function() { | ||
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; | ||
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; | ||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); | ||
})(); | ||
</script> | ||
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<div id="giscus_thread" style="max-width: {{ site.max_width }}; margin: 0 auto;"> | ||
<script> | ||
let giscusTheme = localStorage.getItem("theme"); | ||
let giscusAttributes = { | ||
"src": "https://giscus.app/client.js", | ||
"data-repo": "{{ site.giscus.repo }}", | ||
"data-repo-id": "{{ site.giscus.repo_id }}", | ||
"data-category": "{{ site.giscus.category }}", | ||
"data-category-id": "{{ site.giscus.category_id }}", | ||
"data-mapping": "{{ site.giscus.mapping }}", | ||
"data-strict": "{{ site.giscus.strict }}", | ||
"data-reactions-enabled": "{{ site.giscus.reactions_enabled }}", | ||
"data-emit-metadata": "{{ site.giscus.emit_metadata }}", | ||
"data-input-position": "{{ site.giscus.input_position }}", | ||
"data-theme": giscusTheme, | ||
"data-lang": "{{ site.giscus.lang }}", | ||
"crossorigin": "anonymous", | ||
"async": "", | ||
}; | ||
|
||
|
||
let giscusScript = document.createElement("script"); | ||
Object.entries(giscusAttributes).forEach(([key, value]) => giscusScript.setAttribute(key, value)); | ||
document.getElementById("giscus_thread").appendChild(giscusScript); | ||
</script> | ||
<noscript>Please enable JavaScript to view the <a href="http://giscus.app/?ref_noscript">comments powered by giscus.</a></noscript> | ||
</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
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
6 changes: 3 additions & 3 deletions
6
_posts/2015-10-20-comments.md → _posts/2015-10-20-disqus-comments.md
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 | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
--- | ||
layout: post | ||
title: a post with comments | ||
title: a post with disqus comments | ||
date: 2015-10-20 11:59:00-0400 | ||
description: an example of a blog post with comments | ||
comments: true | ||
description: an example of a blog post with disqus comments | ||
categories: sample-posts external-services | ||
disqus_comments: true | ||
--- | ||
This post shows how to add DISQUS comments. |
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 | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
layout: post | ||
title: a post with redirect | ||
date: 2021-07-04 17:39:00 | ||
date: 2022-02-01 17:39:00 | ||
description: you can also redirect to assets like pdf | ||
redirect: /assets/pdf/example_pdf.pdf | ||
--- |
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
layout: post | ||
title: a post with giscus comments | ||
date: 2022-12-10 11:59:00-0400 | ||
description: an example of a blog post with giscus comments | ||
categories: sample-posts external-services | ||
giscus_comments: true | ||
--- | ||
This post shows how to add GISCUS comments. |
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