disqus / disqus-react

A React component for Disqus
MIT License
369 stars 46 forks source link

Can't set categories for my posts #90

Closed SalahAdDin closed 3 years ago

SalahAdDin commented 3 years ago

Describe the bug

We are passing the categories to the post by the settings and it is not reflected on the Disqus dashboard.

To Reproduce

Steps to reproduce the behavior:

  1. First, setup the next code:
    <DiscussionEmbed
              shortname={DISQUS_SHORT_NAME}
              config={{
                url: postURL,
                identifier: slug,
                title: titleEn,
                /*
                Must be
                First tag: category
                Others: order does not matter
                */
                category_id: DISQUS_CATEGORIES[tags[0]?.slug],
              }}
            />

    where:

    const DISQUS_CATEGORIES = {
    general: "8664428",
    "front-end": "8755878",
    "back-end": "8755881",
    "deep-learning": "8755886",
    "video-games": "8755887",
    }
  2. Publish a new blog on your site with front-end as first tag., it uses NextJS 10.0.5.
  3. Go to the dashboard, Tools > Discussions.
  4. The new post will have General as its category.

Expected behavior

As the first tag front-end, we should see it as the discussions category.

Specifications:

tterb commented 3 years ago

@SalahAdDin Thanks for the report. It looks like the package isn't configured to handle the category variable and pass it to the disqus_config. It shouldn't take too much work to add this functionality, so I can try to put up a PR in the next couple days.

SalahAdDin commented 3 years ago

@tterb Thank you!

tterb commented 3 years ago

@SalahAdDin I just noticed that the package actually does allow you to pass the category ID, but the param is camel-case (ie: categoryID instead of category_id).

SalahAdDin commented 3 years ago

@SalahAdDin I just noticed that the package actually does allow you to pass the category ID, but the param is camel-case (ie: categoryID instead of category_id).

Oh, my mistake them, let me check.

tterb commented 3 years ago

@SalahAdDin I'm gonna assume that this solution worked and close this out, but you can reopen the issue if you're still experiencing issues.

SalahAdDin commented 3 years ago

@tterb categoryId or categoryID (first one is more camelCase)?