Skip to content

Configuration

There are two layers of configuration: the global module options in nuxt.config.ts, and the per-component props you pass at the call site.

Module options live under the disqus key in nuxt.config.ts:

export default defineNuxtConfig({
modules: ['nuxt-disqus'],
disqus: {
shortname: 'your-disqus-shortname',
},
})
OptionTypeDefaultDescription
shortnamestring''Your Disqus site’s shortname. Used as the default shortname for every <DisqusComments /> and <DisqusCount /> in your app.

When a component needs a shortname, it resolves it in this order:

  1. The shortname prop passed directly to the component.
  2. The global disqus.shortname from nuxt.config.ts.

So the global config is the default, and any individual component can override it. If neither is set, Disqus throws "Disqus shortname is required" at runtime.

PropTypeDefaultDescription
identifierstringRequired. Unique, stable identifier that ties the thread to a page.
shortnamestring(global config)Override the Disqus shortname for this thread.
urlstring(none)The canonical page URL Disqus associates with the thread.
classstring(none)CSS class applied to the thread container.
languagestring'en'Disqus interface language for the thread.
lazybooleantrueLoad the embed script only when the thread scrolls into view.
lazyConfigobject{ root: null, rootMargin: '300px', threshold: 0.5 }IntersectionObserver options that control when lazy loading triggers.
pageConfigobject(none)Advanced Disqus page-level config (e.g. title, category_id, slug). Keys are validated against Disqus’s allowed page keys.
ssoConfigobject(none)Single Sign-On config (e.g. name, button, icon, url, logout, profile_url, width, height).

<DisqusComments /> re-emits the Disqus thread callbacks as Vue events: pre-data, pre-init, after-render, init, ready, identify, paginate, new-comment, before-comment, pre-reset.

PropTypeDefaultDescription
identifierstringRequired. Identifier of the page whose count to show. Match the thread’s identifier.
shortnamestring(global config)Override the Disqus shortname for this count.
urlstring(none)The page URL. Used as the link target when tag is "a".
tagstring'span'The HTML element to render the count in. Use 'a' to render it as a link.

The lazyConfig prop is passed straight to the IntersectionObserver that triggers loading. Widen rootMargin to start loading the thread earlier (further before it enters the viewport):

<template>
<DisqusComments
identifier="/blog/1"
:lazy-config="{ root: null, rootMargin: '600px', threshold: 0 }"
/>
</template>

See Basic, Comment Counts, and Lazy Loading for end-to-end recipes.