GithubHelp home page GithubHelp logo

dylanon / gatsby-source-etsy Goto Github PK

View Code? Open in Web Editor NEW
15.0 3.0 8.0 952 KB

Gatsby.js plugin that sources listing info and images from your Etsy shop! ๐Ÿ›

License: MIT License

JavaScript 100.00%
gatsby gatsbyjs etsy gatsby-source-plugin gatsby-source

gatsby-source-etsy's Introduction

gatsby-source-etsy ๐Ÿ›

Note: This plugin is no longer maintained.

Current npm package version

Downloads listing info and images from your Etsy shop!

Installation

Sites on Gatsby v3+

Install the package from npm:

npm i gatsby-source-etsy

Install peer dependencies:

npm i gatsby-source-filesystem

Sites on Gatsby v2

Install version 1 from npm:

npm i [email protected]

Sites on Gatsby v1

Gatsby v1 is not supported.

Configuration

Next, add the plugin to your gatsby-config.js file:

module.exports = {
  plugins: [
    {
      resolve: 'gatsby-source-etsy',
      options: {
        api_key: 'your api key here',
        shop_id: 'your shop id here',
        // The following properties are optional - Most of them narrow the results returned from Etsy.
        //
        // You don't have to use them, and in fact, you probably shouldn't!
        // You're probably here because you need to source *all* your listings.
        language: 'en',
        translate_keywords: true,
        keywords: 'coffee',
        sort_on: 'created',
        sort_order: 'up',
        min_price: 0.01,
        max_price: 999.99,
        color: '#333333',
        color_accuracy: 0,
        tags: 'diy,coffee,brewing',
        taxonomy_id: 18,
        include_private: true,
      },
    },
  ],
}

This plugin supports the options specified in Etsy's documentation under findAllShopListingsActive.

For information on the language and translate_keywords properties, please see Searching Listings.

Example GraphQL queries

Listing info:

{
  allEtsyListing(sort: { fields: featured_rank, order: ASC }, limit: 4) {
    nodes {
      currency_code
      title
      listing_id
      price
      url
    }
  }
}

Query transformed/optimized images for a listing (e.g. for use with gatsby-image - see below):

{
  allEtsyListing(sort: { fields: featured_rank, order: ASC }, limit: 4) {
    nodes {
      childrenEtsyListingImage {
        rank
        childFile {
          childImageSharp {
            fluid {
              base64
              tracedSVG
              aspectRatio
              src
              srcSet
              srcWebp
              srcSetWebp
              originalName
              originalImg
              presentationHeight
              presentationWidth
              sizes
            }
          }
        }
      }
    }
  }
}

Queryable entities

  • allEtsyListing
  • allEtsyListingImage
  • etsyListing
    • childrenEtsyListingImage
  • etsyListingImage
    • childFile

Usage with gatsby-image

Install the necessary packages:

npm install gatsby-image gatsby-plugin-sharp gatsby-transformer-sharp

Query:

{
  etsyListing {
    childrenEtsyListingImage {
      childFile {
        childImageSharp {
          fluid {
            ...GatsbyImageSharpFluid
          }
        }
      }
    }
  }
}

See gatsby-image for more.

Contributing

Did something break, or is there additional functionality you'd like to add to this plugin? Consider contributing to this project!

Feel free to open an issue to discuss what's happening first, or dive right in and open a PR.

Developing this plugin locally

You can use yalc to test changes you make to this plugin against a local Gatsby site:

# Install yalc globally on your system
yarn global add yalc

# Publish the package to your local repository
# (Run this from this repo's root directory)
yalc publish

# Use the package from your local repository instead of one from npm
# (Run this from your Gatsby site's root directory)
yalc add gatsby-source-etsy

For up-to-date information and troubleshooting, see yalc's documentation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.