Python

网站中通常会有一个导航条,如下图

这个导航条在很多页面都会存在

可以把导航条做成一个组件,让要显示导航条的网页包含

导航条组件 nav.html:

<h1>假装这是一个导航条</h1>

用 muban_test.html 来导入:

<hr>
{# 导入导航条组件 #} {% include 'nav.html' %} <h1>hello world</h1>
<hr>

运行结果:

原文地址:https://www.cnblogs.com/sch01ar/p/11265556.html