Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Cusdis in nextra-theme-blog #143

Merged
merged 4 commits into from
May 1, 2021
Merged

Support Cusdis in nextra-theme-blog #143

merged 4 commits into from
May 1, 2021

Conversation

djyde
Copy link
Contributor

@djyde djyde commented Apr 25, 2021

I add a comments props in Layout, so if we want to add another comment widget, we can just pass different comments component to the Layout

Usage:

In theme.config.js:

export default {
  cusdis: {
    appId: 'xxx',
    host: 'https://cusdis.com', // optional
    lang: 'zh-cn', // optional
  }
}

Preview:

image

@vercel
Copy link

vercel bot commented Apr 25, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

nextra – ./

🔍 Inspect: https://vercel.com/shuding/nextra/AQFsD98a2SjtVN9WNzQfW496CBnt
✅ Preview: Canceled

[Deployment for b456f27 failed]

nextra-dev – ./examples/docs

🔍 Inspect: https://vercel.com/shuding/nextra-dev/3pzuBepqMTdEgAvEUnmE6pzHYQzp
✅ Preview: https://nextra-dev-git-fork-djyde-cusdis-shuding1.vercel.app

@vercel vercel bot temporarily deployed to Preview – nextra April 25, 2021 16:28 Inactive
@vercel vercel bot temporarily deployed to Preview – nextra-dev April 25, 2021 16:28 Inactive
@@ -13,13 +13,17 @@ import getTitle from './utils/get-title'
import getTags from './utils/get-tags'
import sortDate from './utils/sort-date'

// comments
import { ReactCusdis } from 'react-cusdis'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { ReactCusdis } from 'react-cusdis'
import dynamic from 'next/dynamic'
const ReactCusdis = dynamic(
() => import('react-cusdis').then((mod) => mod.ReactCusdis),
{ ssr: false }
)

With dynamic import, the module won't be included in the bundle if the cusdis option is not enabled.

Copy link
Owner

@shuding shuding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@YikSanChan
Copy link

@djyde I would suggest also adding docs on nextra.vercel.app describing the exciting feature!

@djyde
Copy link
Contributor Author

djyde commented Apr 27, 2021

Done

@YikSanChan
Copy link

@djyde It seems there is a check failing

@shuding shuding merged commit 05fca56 into shuding:core May 1, 2021
@YikSanChan
Copy link

@shuding When will this PR get released? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants