更新 'src/DjangoBlog-master/templates/share_layout/nav_node.html'

fz_branch
pa2g3nmk9 4 months ago
parent 34b31ec891
commit 39fad5bb5b

@ -1,19 +1,17 @@
<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 %}
<li id="menu-item-{{ node.pk }}" {# ID #}
class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-has-children menu-item-{{ node.pk }}"> {# 菜单项CSS类 #}
<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 %}
{% with node=child template_name="share_layout/nav_node.html" %}
{% include template_name %}
<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…
Cancel
Save