How to show sub-categories as home page?

Moved Technical Support
  • #1

    I have a few cateogories, but some has also subcategories (sub-forums) inside. I want to skow these subcategories as home page, where we can't write a post outside any category.

    One image tells better what I want:


    I want to remove all the buttons (New topic, etc) and the block without posts "There are no topics in this category. Why don't you try posting one?"

    And push up the sidebar widgets, all the same as main page.


  • #2

    Subcategories are created in the header, not the content section, which is why the sidebar doesn't line up.

    You could try disabling everyone's ability to create topics in that main category. You might still see that message, but your users wouldn't (I think).

  • #3

    Hello, I've changed lavender's category.tpl file, changed 2 things,

    • Sidebar is In line, like in home, and subcategories and current category are both at left.
    • Added a class to category stuff that allows to hide buttons and posts via css. It is quite workaround but is working.

    file is here:

    The class name is: .category-stuff-id-{cid} where {cid} is the number of category to be hidden (you can see category id in the browser's address bar after /category/), via admin panel, exemple, like in my test if one wants to hide category 22 , the person goes to "admin panel" -> "appearance" - > "custom css & html", and add a line at the end:

    .category-stuff-id-22 { display: none; }

    To use the file change /nodebb/node_modules/nodebb-theme-lavender/templates/category.tpl for it and then restart nodebb.

    edit: if it is not working maybe you need to clear your browser's cache or use incognito mode to test it!!

  • #4

    @priapo thank you so much!! Tomorrow I will do these changes and come with the comments 👍

  • #5

    Please use this instead

    The other will not expand if you have no widgets.


  • GNU/Linux

    @priapo The change you made to move the subcategories into the main content container (so the sidebar isn't bumped down) is a positive change, and we've love to see it in a PR to lavender 😄

  • #7

    The trick is more simple. Thanks to your suggestion, I have the latests lavender theme (2.2.3) and modify only one line in category.tpl

    from this
    <div class="category row">

    to this:
    <div class="category row category-stuff-id-{cid}">

    There is no need to add subcatcat-container nor other stuff. Get the clean file and change only this line. This works for me because I no want show widget under subcategory



  • #8

    Ok. it was my first pull request ever, hope I did it correctly. =]

Suggested Topics

| | | |