Skip to content

Commit

Permalink
feat: read disqus_shortname from theme config (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang authored Apr 8, 2024
1 parent a65ddd4 commit e7b1861
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Deploy preview site
on:
# Runs on pushes targeting the default branch
push:
branches: [$default-branch]
branches: [master]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down
4 changes: 3 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ google_analytics:
rss:

comment_provider: facebook
# Disqus comment
disqus_shortname:
# Facebook comment
facebook:
appid: 123456789012345
appid: # <appId>
comment_count: 5
comment_width: 840
comment_colorscheme: light
4 changes: 2 additions & 2 deletions layout/_partial/after_footer.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<%- js('js/jquery.imagesloaded.min.js') %>
<%- js('js/gallery.js') %>

<% if (config.disqus_shortname){ %>
<% if (theme.disqus_shortname){ %>
<script>
var disqus_shortname = '<%= config.disqus_shortname %>';
var disqus_shortname = '<%= theme.disqus_shortname %>';
(function(){
var dsq = document.createElement('script');
Expand Down
2 changes: 1 addition & 1 deletion layout/_partial/article.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<a href="<%- url_for(item.path) %>#more" class="more-link"><%= theme.excerpt_link %></a>
</div>
<% } %>
<% if (item.comment && config.disqus_shortname){ %>
<% if (item.comments && theme.disqus_shortname){ %>
<div class="alignright">
<a href="<%- item.permalink %>#disqus_thread" class="comment-link">Comments</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion layout/_partial/comment.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
if (theme.facebook) { %>
<%- partial('_partial/facebook_comment', {fbConfig: theme.facebook}) %>
<% } %>
<% } else if(config.disqus_shortname) { %>
<% } else if(theme.disqus_shortname) { %>
<div id="disqus_thread">
<noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
Expand Down

0 comments on commit e7b1861

Please sign in to comment.