By continuing to use this site, you agree to the storing of first- and third-party cookies on your device to enhance site navigation; analyze site, product, and service usage; and assist in our marketing and promotional efforts. Cookie Policy

 
Skip to Content

Comments Asset

Unlike other assets, comments assets are not their own asset type. Instead, they are a source code asset with specially configured code inserted that connects to the third-party platform Disqus. Using the comments asset adds a Disqus-powered comments section to any page that the asset is inserted on.

As part of the LDP module, comments assets require LDP to be purchased and activated before they can be used in your site.

Generally, once comments is set up, there is no need to create additional assets. The same asset can be used on multiple pages and each page will have its own unique comments. However, it is possible to have multiple Disqus accounts, to segment down moderation to different administrators, in which case there would need to be an asset for each Disqus account.

Set UpLink to this section

Once LDP has been purchased, our implementations team provides you with code for the comments asset and add the necessary code to your web pages for it to work. As an administrator, you are required to create an account with Disqus and connect that account to the premade asset.

  1. Go to the Disqus website and create an account.
  2. When instructed, follow the steps to install Disqus on a site.
    • Write down the shortname for your site, as you will use this to link Disqus to OU Campus.
    • When asked to choose a platform, use "Universal Code." Ignore the code they give you, since you will be using our preconfigured code for the asset. This asset should have already been created during your implementation, but if not (or if you accidentally delete the original), the code can be found below these steps.
  3. Return to OU Campus and locate the comments asset in Content > Assets.
  4. Wherever the code says EXAMPLE, replace it with your site shortname.
  5. Optionally, uncomment and configure one or both of the two configuration variables, this.page.url and this.page.identifier. Read more about these two variables on this page from Disqus. These variables are meant to enhance the reporting capabilities of Disqus, and their values will change on a per-page basis.
  6. Save and publish the asset. It is now ready to be placed on pages.

Use the Disqus dashboard to moderate comments and other administrator tasks. For ease of access, consider linking to Disqus in the add-ons menu.

  • Comments Asset Code
    <div id="disqus_thread"></div>
    <script>
        /**
         *  RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
         *  LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables
         */
        /*
    
        var disqus_config = function () {
            this.page.url = page_url;  // Replace PAGE_URL with your page's canonical URL variable
            //this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
        };
        */
    
        // REQUIRED CONFIGURATION VARIABLE: EDIT THE SHORTNAME BELOW
        var shortname = 'EXAMPLE'; //IMPORTANT: Replace EXAMPLE with your forum shortname!
    
        (function() {  
            var d = document, s = d.createElement('script');
    
            s.src = '//' + shortname + '.disqus.com/embed.js';
    
            s.setAttribute('data-timestamp', +new Date());
            (d.head || d.body).appendChild(s);
        })();
    </script>
    <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>

    In addition to the source code asset, a small script is placed in the <head> of each page on the site, which allows the same comments asset to be used on multiple pages. The script indicates on which page the comment came from, and works in conjunction with the this.page.url variable located in the asset. Make sure this variable is uncommented in order to use this functionality.

    This code is typically placed during the implementation process. Should it need to be re-added, place it in the <head> tag of common.xsl (or similar, like default.xsl). It looks like this:

    <script type="text/javascript">
         var page_url="<xsl:value-of select="concat(string-join(remove(tokenize(substring($ou:httproot, 1), '/'), count(tokenize(substring($ou:httproot, 1), '/'))), '/'),$ou:path)"/>";
    </script>

UseLink to this section

Comments assets are inserted onto pages like normal assets. However, the comments forum displays at the bottom of the page, regardless of where in the page content the asset is placed. We recommend placing the asset at the end of the page, so as not to get in the way of writing content. Save and publish the page for comments to appear.

EditLink to this section

To edit an existing comments asset:

  1. Navigate to Content Assets.
  2. Click on the name of the asset you want to edit.
  3. Check out the asset by selecting the lightbulb icon. 
  4. Click Edit in the main toolbar.
  5. Edit the source code as necessary.
  6. Click Save.
  7. Publish the asset for your changes to appear on the live website.