How to show sub-categories as home page?



  • 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:

    upload-4118ad1f-88d0-4cac-94c3-e875e468bd0c

    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.

    Thanks



  • 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).



  • 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!!



  • @priapo thank you so much!! Tomorrow I will do these changes and come with the comments :+1:



  • Please use this instead

    https://github.com/kassius/nodebb-theme-aspic/blob/master/templates/category.tpl

    The other will not expand if you have no widgets.

    category.tpl


  • Admin

    @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 :smile:



  • 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

    upload-2b08f585-bdbf-4c0f-b2bc-99ce8d78caff

    upload-b99ba4d5-4c4f-439a-b33f-8f3f8e6ed3ac



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


Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.