npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gatsby-source-netlify-comments

v0.0.8-alpha.1

Published

A plugin for using comments in Gatsby

Downloads

39

Readme

Netlify Comments

A simple package to allow way to add comments to your static website. This package is used in conjunction with netlify-comments.

Table of Contents

Getting Started

Installing Packages

To get started, just install netlify-comments and the Gatsby plugin, gatsby-plugin-netlify-comments.

Using NPM:

npm install --save netlify-comments gatsby-plugin-netlify-comments

Using Yarn:

yarn add netlify-comments gatsby-plugin-netlify-comments

Configuration

In order to use Netlify Comments with Gatsby, you need to add the plugin to your gatsby-config.js file at the root of your project.

module.exports = {
	...,
	plugins: [
		...,
		{
			resolve: 'gatsby-plugin-netlify-comments',
			options: {
				...
			},
		}
	]
}

After updating your gatsby-config.js file, you need to add a few options to the configuration in order for netlify to work.

First, you need a Netlify site ID. This can be found from your Netlify site dashboard by visiting Settings > General > Site details > Site information. Copy the value for API ID and store it in your environment variables as NETLIFY_SITE_ID. Then, use the environment variable as the value for the siteId options in gatsby-config.js

options: {
	...,
	siteId: process.env.NETLIFY_SITE_ID
}

The second mandatory value in the options object is the apiKey. This must be created manually in Netlify. Visit your User Settings > Applications at this link: (Personal Access Tokens)

Click "New Access Token" and follow the steps to generate a new API token. Copy this value and store it in your environment variables as NETLIFY_TOKEN. Then, update your options configuration in gatsby-config.js to use this new value.

options: {
	...,
	siteId: process.env.NETLIFY_SITE_ID,
	apiKey: process.env.NETLIFY_TOKEN
}

Adding Comment Functionality

Netlify Comments is set up to automatically filter all comments by page and only display the ones for that page. This means that you can have as many comment forms as you'd like on your site.

The package comes with 2 main components: Form and Comments. Form is the comment form, while Comments is the component that displays your comments (go figure 🤷‍♂️)

Adding a Form

To add a comment form to your page, just import it

import { Form } from 'netlify-comments';

and add it wherever you please

<Form {props} />

This form can be customized, but we'll get to that later. First, you have to display your comments somewhere!

Displaying Your Comments

To display your comments, simply import the Comments compoment

import { Comments } from 'netlify-comments';

and add it wherever you'd like. Usually, this would be directly below the Form

<Form {props} />
<Comments {props} />

Custom Configuration

Because everyone likes to do things their own way.

Netlify Comments allows you to customize the styling of your Form and your Comments components by accepting style props.

Netlify Comments uses styled-components for styling, so you can pass any valid styled-components syntax through these props.

To customize the form, use these two props: the inputStyles prop and the buttonStyles prop.

<Form inputStyles={`padding: 0; background: red; outline: none;`} />

To customize the comment display, use these props: the commentStyles and replyStyles props.

<Comments wrapperStyles={`padding: 16px; box-shadow: 2px 2px 6px -2px #00000090;`} />

Support

Netlify Comments is currently in beta stages, and is constantly evolving and improving. If you have any questions or need help setting up netlify, you can open an issue on Github or email me at [email protected]