styxlab / gatsby-theme-try-ghost

A Gatsby theme to build flaring fast blogs from headless Ghost CMS
MIT License
136 stars 56 forks source link

feat: pass additional params for cusdis support, maintain backward co… #296

Closed sawilde closed 2 years ago

sawilde commented 2 years ago

extend data passed to comments to allow easier extension for other comment systems eg

to use the cusdis comments system via gatsby-plugin-cusdis your would

and then update gatsby-config.js with

        {
            resolve: `gatsby-plugin-cusdis`,
            options: {
                appId: `your-cusdis-id`,
                host: `your-cusdis-host`, // not required, default https://cusdis.com
            },
        },

and then add a shadow copy of Comments.js with

import React from 'react'
import PropTypes from 'prop-types'
import Cusdis from 'gatsby-plugin-cusdis'

const Comments = ({ id, title, url }) => {
    const attrs = {
        pageId: id.substr(13),
        pageUrl: url,
        pageTitle: title,
        theme: `auto`,
    }

    return (
        <Cusdis attrs={attrs} />
    )
}

Comments.propTypes = {
    id: PropTypes.string,
    title: PropTypes.string,
    url: PropTypes.string,
}

export default Comments
sawilde commented 2 years ago

thanks