Configuration variables are used as parameters for Disqus' behaviors and settings. They are defined within the HTML of the page on which Disqus is loaded.
These variables must be defined on each page on which Disqus is loaded, so include them in your dynamic templates which render pages.
Placing configuration variables
Configuration variables are added anywhere on the page before the embed.js script, and are wrapped in script tags. For example:
<script type="text/javascript">
var disqus_title = 'Hello world!';
</script>
If you're using one of our plugins such as Wordpress, it's best to put this in your "header.php" template (or equivalent) rather than editing the plugin files.
Variables
disqus_developer
Tells the Disqus service that you are testing the system on an inaccessible website, e.g. secured staging server or a local environment. If disqus_developer is off or undefined, Disqus' default behavior will be to attempt to read the location of your page and validate the URL. If unsuccessful, Disqus will not load. Use this variable to get around this restriction while you are testing on an inaccessible website.
Usage: Specify 1 for on and 0 for off. If undefined, disqus_developer is off.
Example: var disqus_developer = 1; // developer mode is on
disqus_shortname
Tells the Disqus service your forum's shortname, which is the unique identifier for your website as registered on Disqus. If undefined, the Disqus embed script will make a best-guess based on the URL of the Disqus embed script.
Usage: Specify your forum shortname as string.
Example: var disqus_shortname = 'example';
disqus_identifier
Tells the Disqus service how to identify the current page. When the Disqus embed is loaded, the identifier is used to look up the correct thread. If disqus_identifier is undefined, the page's URL will be used. The URL can be unreliable, such as when renaming an article slug or changing domains, so we recommend using your own unique way of identifying a thread.
Plugins, such as Disqus for WordPress, will automatically have this defined as the id of the blog post.
Usage: Specify a string or an integer as your unique identifier. This can be dynamically rendered server-side.
Example:
The following uses an article slug as the identifier.
var disqus_identifier = '/december-2010/the-best-day-of-my-life/';
The following uses a unique id as an identifier.
var disqus_identifier = '2583573';
Most likely you will be rendering the values dynamically server-side in your platform or CMS. The following is an example using PHP.
var disqus_identifier = '<? php echo $my_identifier; ?>';
disqus_url
Tells the Disqus service the URL of the current page. If undefined, Disqus will take the window.location.href. This URL is used to look up or create a thread if disqus_identifier is undefined. In addition, this URL is always saved when a thread is being created so that Disqus knows what page a thread belongs to.
While the window.location.href is used in absence of disqus_url, we highly recommend defining this variable. If a user visits your page at the URL http://example.com/helloworld.html?123, Disqus may in fact load a different thread than if the user came from http://example.com/helloworld.html.
To make sure the right thread is always displayed, you should define on your page var disqus_url = 'http://example.com/helloworld.html';
disqus_title
Tells the Disqus service the title of the current page. This is used when creating the thread on Disqus for the first time. If undefined, Disqus will use the <title> attribute of the page. If that attribute could not be used, Disqus will use the URL of the page.
Having comment threads titled http://example.com/helloworld.html isn't very pretty!
disqus_category_id
Tells the Disqus service the category to be used for the current page. This is used when creating the thread on Disqus for the first time.
Categories are primarily used with our API for results filtering; categories are not used for moderation (e.g., to filter comments by category in the moderation panel). New categories can be created at Settings > General or with our categories API endpoints.
JavaScript Usage: Specify a category ID (not title). If undefined, Disqus will use the forum's default General category.
Example: var disqus_category_id = '123456'; // using category Sports which has ID 123456
API Usage: Filter results by category.
Example: Utilize the categories/listPosts endpoint (or the category parameter in conjunction with the posts/list endpoint) to list comments only from a certain category.
