forked from plhw57tbe/SoftwareMethodology
parent
5daf91747c
commit
43bb22126f
@ -1,19 +1,21 @@
|
||||
{# 导航菜单节点模板 - 支持递归渲染子菜单 #}
|
||||
<li id="menu-item-{{ node.pk }}"
|
||||
class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-{{ node.pk }}">
|
||||
{# 当前分类链接 #}
|
||||
<a href="{{ node.get_absolute_url }}">{{ node.name }}</a>
|
||||
|
||||
{# 加载子分类 #}
|
||||
{% load blog_tags %}
|
||||
{% query nav_category_list parent_category=node as child_categorys %}
|
||||
{% if child_categorys %}
|
||||
|
||||
<ul class="sub-menu">
|
||||
{% for child in child_categorys %}
|
||||
{% query nav_category_list parent_category=node as child_categorys %} {# 查询当前分类的子分类 #}
|
||||
|
||||
{% if child_categorys %} {# 如果存在子分类 #}
|
||||
<ul class="sub-menu"> {# 子菜单容器 #}
|
||||
{% for child in child_categorys %} {# 遍历所有子分类 #}
|
||||
{# 递归调用自身模板渲染子分类 #}
|
||||
{% with node=child template_name="share_layout/nav_node.html" %}
|
||||
{% include template_name %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
|
||||
|
||||
</li>
|
||||
Loading…
Reference in new issue