No internet connection
  1. Home
  2. Ideas

Option to change the category that embedded comments go to

By @bbaovanc
    2022-04-09 00:55:48.715Z

    I want my default category on my forum to be General, but I also want a separate category for all the blog comments.

    Solved in post #4, click to view
    • 5 replies
    1. KajMagnus @KajMagnus2022-04-13 14:36:40.232Z2022-04-14 07:46:54.073Z

      This can be done. The blog comment discussions get created in whichever category has its external ID set to embedded_comments.

      If you created a blog comments Talkyard site, there'll be just one category, named Blog Comments, and with its external ID set to embedded_comments. But you cannot see it — by default, categories are hidden, when you create a blog comments site. But if you enable forum features (in the Features settings page, see below), and thereafter create a General category, then, the blog comment will still get created in the Blog Comments category and things should work like you want.

      If you created a forum, (which you did, if you can see any categories, which seems to be the case, since you mentioned the General category)
      then, you can enable the API in the admin area, and then create a Blog Comments category yourself, and give it the embedded_comment external ID — as folllows:

      1. Go to the Features settings page: Click your username to the upper right, then click Admin, then, in the menu to the left, click Features. (Here's a URL: https:// talkyard /-/admin/settings/features )

      2. Tick the Enable API checkbox, then Save at the bottom (otherwise the External ID setting won't appear).

      3. Go to the categories page: https:// talkyard /categories

      4. Click Create Category.

      5. At the bottom of the new category dialog, click External ID (optional): None, and copy-paste: embedded_comments. Click Create, to create the category.

      6. (I forgot) Edit the embedding HTML code in your blog: Add: data-category="extid:embedded_comments" so it looks like:

        <div class="talkyard-comments" ... data-category="extid:embedded_comments" />
        

      Now, discussions for new blog posts, should get created in that embedded comments category.

      Please let me know how it goes?

      1. B@bbaovanc
          2022-04-13 17:05:06.204Z

          It didn't work for me. Enable API was already enabled, and I changed the external ID of my existing blog category to embedded_comments. The topics are still being created in General. I also tried changing the external ID of General to something else (general) but that didn't help.

          1. KajMagnus @KajMagnus2022-04-14 07:37:11.661Z2022-04-14 07:50:24.044Z

            Oops sorry. You'll need to add this to the embedding HTML pages: data-category="extid:embedded_comments" — otherwise the embedded discussions get created in the default* category.

            (* What's the default category? In the edit category dialog, there's a checkbox: [ ] Set as default category which: "Places new topics in this category, if no other category selected".)

            So, the embedding HTML snippet would look something like:

            <div class="talkyard-comments" data-discussion-id="..." data-category="extid:embedded_comments"/>
            

            This: data-category="extid:abcd tells Talkyard to place the comments in the category with external id "abcd".

            (And, as you might have noticed, if you have many blogs, you could have comments from each blog, end up in its own category — by using different extid:... for different blogs of yours.)

            ( Probably not, but If you'd like to look at an end-to-end test, there is one: https://github.com/debiki/talkyard/blob/main/tests/e2e/specs/embedded-comments-category-refs.2browsers.test.ts )

            ReplySolution
            1. B@bbaovanc
                2022-04-15 00:04:13.635Z

                Thanks, adding that data-category field worked!

                1. Ok :- ) Thanks for the update