Step 1: Install vue-disqus
Like always, install the library into the project first and then define a new plugin to store the configuration.
yarn add vue-disqus
import Vue from 'vue' import VueDisqus from 'vue-disqus' Vue.use(VueDisqus, { shortname: 'your_shortname_disqus' })
Step 2: Define in nuxt.config.js
Reference the plugin in the nuxt configuration file like below and set the mode to "client" where it's only available in the browser and not on the server. If you are wondering why is the configuration like that then the answer is that this plugin is only for the production environment. If you have not read my other post for Splitting Nuxt Js Configuration Based on the Environment, do give it a read as it contains information on how this kind of config is done and beneficial for Nuxt project.
const config = {} if (process.env.NODE_ENV === "production") { config.plugins.push(...[ { src: './plugins/disqus.js', mode: 'client' } ]) } export default config
Step 3: Call Discord Component
The last and final step is to define the component in the place where we want to show the comment.
<client-only> <Disqus/> </client-only>
<DisqusCount identifier="your_identifier_here" >