{"id":109,"date":"2012-02-17T00:00:00","date_gmt":"2012-02-17T00:00:00","guid":{"rendered":"http:\/\/bloodforge.com\/?p=109"},"modified":"2020-02-20T03:26:56","modified_gmt":"2020-02-20T03:26:56","slug":"new-comment-system","status":"publish","type":"post","link":"https:\/\/bloodforge.azurewebsites.net\/index.php\/2012\/02\/17\/new-comment-system\/","title":{"rendered":"New Comment System"},"content":{"rendered":"\n<p>The blog now uses a new comment system &#8211;&nbsp;<a href=\"http:\/\/www.disqus.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Disqus<\/a>.<\/p>\n\n\n\n<p>I upgraded to BE v2.5, and found various instructions on how to move to Disqus&#8230;&nbsp;<a href=\"http:\/\/surinder.computing-studio.com\/post\/2011\/07\/27\/BlogEngine-Disqus-Comment-Count-Fix.aspx\" target=\"_blank\" rel=\"noreferrer noopener\">including these<\/a>.<\/p>\n\n\n\n<p>There was one problem, however. The instructions state that on post.aspx, JavaScript needs to change to the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;script type=\"text\/javascript\">\n    var disqus_title = '&lt;%=Post.Title %>';\n    var disqus_identifier = '&lt;%= Post.Id.ToString() %>';\n    var disqus_url = '&lt;%= Post.AbsoluteLink %>';\n    var disqus_developer = '&lt;%= BlogEngine.Core.BlogSettings.Instance.DisqusDevMode ? 1 : 0 %>';\n    (function () {\n        var dsq = document.createElement('script'); dsq.type = 'text\/javascript'; dsq.async = true;\n        dsq.src = 'http:\/\/&lt;%=BlogEngine.Core.BlogSettings.Instance.DisqusWebsiteName %>.disqus.com\/embed.js';\n        (document.getElementsByTagName('head')&#91;0] || document.getElementsByTagName('body')&#91;0]).appendChild(dsq);\n    })();\n&lt;\/script><\/code><\/pre>\n\n\n\n<p> However, that is not accurate and will result in errors.\u00a0 The correct code needs to reference Page, and not Post. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;script type=\"text\/javascript\">\n    var disqus_title = '&lt;%=Page.Title %>';\n    var disqus_identifier = '&lt;%= Page.Id.ToString() %>';\n    var disqus_url = '&lt;%= Page.AbsoluteLink %>';\n    var disqus_developer = '&lt;%= BlogEngine.Core.BlogSettings.Instance.DisqusDevMode ? 1 : 0 %>';\n    (function () {\n        var dsq = document.createElement('script'); dsq.type = 'text\/javascript'; dsq.async = true;\n        dsq.src = 'http:\/\/&lt;%=BlogEngine.Core.BlogSettings.Instance.DisqusWebsiteName %>.disqus.com\/embed.js';\n        (document.getElementsByTagName('head')&#91;0] || document.getElementsByTagName('body')&#91;0]).appendChild(dsq);\n    })();\n&lt;\/script><\/code><\/pre>\n\n\n\n<p> If the above is not changed, the blog will throw the following error: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>page.aspx(14): error CS0120: An object reference is required for the non-static field, method, or property 'BlogEngine.Core.Post.Title.get'<\/code><\/pre>\n\n\n\n<p> One more change needs to be done if the above takes place. In archive.aspx.cs, the following line: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>comments.InnerHtml = string.Format(\"&lt;span>&lt;a href=\\\"{0}#disqus_thread\\\">{1}&lt;\/a>&lt;\/span>\", post.PermaLink, Resources.labels.comments);<\/code><\/pre>\n\n\n\n<p> needs to change to: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>comments.InnerHtml = string.Format(\"&lt;span>&lt;a href=\\\"{0}#disqus_thread\\\">{1}&lt;\/a>&lt;\/span>\", post.AbsoluteLink, Resources.labels.comments);<\/code><\/pre>\n\n\n\n<p> The change above will allow the Archive to correctly display the number of comments and reactions to each post. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>The blog now uses a new comment system &#8211;&nbsp;Disqus. I upgraded to BE v2.5, and found various instructions on how to move to Disqus&#8230;&nbsp;including these. There was one problem, however. The instructions state that on post.aspx, JavaScript needs to change to the following: However, that is not accurate and will result in errors.\u00a0 The correct [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/bloodforge.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/posts\/109"}],"collection":[{"href":"https:\/\/bloodforge.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bloodforge.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bloodforge.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bloodforge.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/comments?post=109"}],"version-history":[{"count":1,"href":"https:\/\/bloodforge.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/posts\/109\/revisions"}],"predecessor-version":[{"id":110,"href":"https:\/\/bloodforge.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/posts\/109\/revisions\/110"}],"wp:attachment":[{"href":"https:\/\/bloodforge.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/media?parent=109"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bloodforge.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/categories?post=109"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bloodforge.azurewebsites.net\/index.php\/wp-json\/wp\/v2\/tags?post=109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}