1.0.0 • Published 5 years ago

gatsby-source-disqus-xml v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Gatsby Disqus XML Source Plugin

A Gatsby source plugin to use a Disqus XML export as a data source.

Given a Disqus XML export, this source plugin will make threads & comments available to query via GraphQL. This will allow you to statically render comments and not include the Disqus embed code on your site. This can be useful if you are trying to migrate away from Disqus but you don't want to lose your existing comments. Or it could be useful if you want to server-render your comments for SEO purposes and replace the comment div with the Disqus embed code at runtime.

Install

yarn add gatsby-source-disqus-xml

or

npm install gatsby-source-disqus-xml

How to use

In gatsby-config.js:

module.exports = {
  plugins: [
    {
      resolve: `gatsby-source-disqus-xml`,
      options: {
        filePath: "my_disqus_export.xml"
      },
    },
  ],
}

Query for Nodes

You can query for all threads:

{
  allDisqusThread {
    edges {
      node {
        threadId
        link
        comments {
          id
          parentId
          author {
            name
            username
          }
          createdAt
          message
        }
      }
    }
  }
}

or for a specific thread:

{
  query CommentThreadById($threadId: String!) {
    disqusThread( threadId: { eq: $threadId }) {
      threadId
      link
      comments {
        id
        parentId
        author {
          name
          username
        }
        createdAt
        message
      }
    }
  }
}
1.0.0

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago