How to get subcategories from home.tpl?
-
Hello, happy new year 8 )
I was reading this https://docs.nodebb.org/en/latest/themes/templates.html but can't manage to get subcategories from home, I would like to show subcategories in nodebb home like this - ie., below category description and above teasers: (Sub-forums: forum1, forum2) etc
I've tried this
<!-- BEGIN categories.children --> <!-- IF @first --> <div class="category-subforums"> subforums: <!-- ENDIF @first --> {categories.children.name} - <!-- IF @last --> </div> <!-- ENDIF @last --> <!-- END categories.children -->
But doesn't works...maybe because it is inside another begin loop?
Thanks
-
Ok, this works
<!-- IF categories.children.length --> <!-- BEGIN children --> <!-- IF @first -->(Sub-forums: <!-- ENDIF @first --> <a href="\{relative_path\}/category/{categories.children.slug}" itemprop="url">{categories.children.name}</a> <!-- IF !@last --> · <!-- ENDIF !@last --> <!-- IF @last -->)<!-- ENDIF @last --> <!-- END children --> <!-- ENDIF categories.children.length -->
Just put it somewhere between
<!-- BEGIN categories -->
and<!--END categories -->
in home.tplAnd take both \ from {relative_path}.. it seems that nodebb parses it... so I had to type...
Copyright © 2024 NodeBB | Contributors