gatsby-plugin-waline
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

gatsby-plugin-waline

npm version

A Gatsby plugin for Waline comment system.

中文文档

Features

This plugin help you use Waline comment system more easy in your website.

  • Pure wrapping of the latest Waline with React Hooks API
  • Support all options of Waline
  • Written in TypeScript

🚚 Installation

npm install gatsby-plugin-waline
npm install -D @waline/client

or

yarn add gatsby-plugin-waline
yarn add -D @waline/client

This plugin requires React v16.8 or above.

🔦 Usage

  1. Follow this document to deploy the server side.

  2. Enable the plugin in your gatsby-config.js

    // In your gatsby-config.js
    plugins: [
        {
            resolve: `gatsby-plugin-waline`,
            options: {
                // plugin options here
                serverURL: 'YOUR_SERVER_URL',
            },
        },
    ];
  3. Use <Waline /> component in your page code

    import React from 'react';
    import Waline from 'gatsby-plugin-waline';
    
    export default function Page({location}) {
        return (
            <Layout>
                <Waline path={location.pathname} /*component options here*/ />
            </Layout>
        );
    }

    Plugin options and component options are same. You can put common options (e.g. serverURL, emoji) in plugin options, some options (e.g. path) that you want to set separately for certain pages can be placed in component options. The options will be merged and the options from the component will have higher priority.

  4. Import CSS file(s) in your gatsby-browser.js

    // In your gatsby-browser.js
    import '@waline/client/dist/waline.css';

    For more detail about style customize, see https://waline.js.org/en/guide/features/style.html

After that, you should be able to add and see comments on your website.

🔧 Options

Check here: https://waline.js.org/en/reference/client/props.html

Dependents (0)

Package Sidebar

Install

npm i gatsby-plugin-waline

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

11.2 kB

Total Files

12

Last publish

Collaborators

  • taozc009