Letterdrop Gatsby

Letterdrop Gatsby Source Plugin

Source plugin for sourcing data from Letterdrop Posts data.


Install

npm i @letterdropcom/gatsby-source-letterdrop


How to use

The plugin requires your publication api-key from Letterdrop. Check here to know how to generate and use an API key.

Once you got your api-key use the following configuration in your Gatsby Site.

# In your gatsby-config.js
plugins: [
    {
        resolve: "@letterdropcom/gatsby-source-letterdrop",
        options: {
            apikey: "<your-api-key>",
            version: "v1" # default version
        }
    }
]

How to query

Upon querying the plugin, it return a single / list of Post nodes. Check the response for the full set of fields made available from Letterdrop Get Post API

Example post query

{
  allLetterdropPosts {
    nodes {
      url
      title
      ...
      coverImage {
        url
        extension
        ...
      }
      publication {
        customDomain {
          domain
          ...
        }
        _id
        domain
      }
      postAuthor {
        _id
        name
      }
    }
  }
}

Example post query with filter

Assume you need to query post url adapt-your-writing from allLetterdropPosts, specify the filter like below

{
  allLetterdropPosts(filter: {url: {eq: "adapt-your-writing"}}) {
    nodes {
      url
      title
      ...
      coverImage {
        url
        extension
        ...
      }
      publication {
        customDomain {
          domain
          ...
        }
        _id
        domain
      }
      postAuthor {
        _id
        name
      }
    }
  }
}



Copyright

Copyright © 2021 Letterdrop