express - 无法在哈巴狗中扩展布局
问题描述
在我的索引文件中,我使用以下标记扩展布局:
extends layout
html
script(src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.js')
link(rel='stylesheet', href='/stylesheets/style.css')
link(rel='stylesheet',href='//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css')
script(src='//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js')
block content
h1= title
body
nav
.navbar.navbar-inverse
.container-fluid
.navbar-header
a
.navbar-brand(href='#') WebSiteName
ul.nav.navbar-nav
li.active
a(href='#') Home
li
a(href='#') Issues
li
a(href='#') Page 2
li
a(href='#') Page 3
我收到以下错误:只有命名块和 mixin 可以出现在扩展模板的顶层。
谷歌搜索并尝试了一些没有帮助的基本修复
布局.pug:
doctype html
html
head
title= title
link(rel='stylesheet', href='stylesheets/style.css')
block content
body
nav
.navbar
.container-fluid
.navbar-header
a
.navbar-brand(href='#') WebSiteName
ul.nav.navbar-nav
li.active
a(href='#') Home
li
a(href='#') Page 1
li
a(href='#') Page 2
li
a(href='#') Page 3
解决方案
可以分享你的扩展布局代码吗?也尝试给 body 和它的子元素一个选项卡。
extends layout
block content
h1= title
body
script(src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.js')
link(rel='stylesheet', href='/stylesheets/style.css')
link(rel='stylesheet',href='//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css')
script(src='//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js')
nav
.navbar.navbar-inverse
.container-fluid
.navbar-header
a
.navbar-brand(href='#') WebSiteName
ul.nav.navbar-nav
li.active
a(href='#') Home
li
a(href='#') Issues
li
a(href='#') Page 2
li
a(href='#') Page 3
推荐阅读
- c++ - 如何调整预先声明的节点的内容?
- sharepoint - 如何让我的 datacardvalue 框根据框中的值更改其填充颜色?
- java - 在列表上循环,然后使用休眠保存对象,但在第一次迭代中它成功但没有保存数据但运行没有错误(使用 GCP(端点))
- python - PyErr_Restore 之后的 PyErr_Print
- python-3.x - 如何使用 JSON.dump() 输出不带反斜杠的换行符?
- php - 防止 $ 在 PHP 脚本的命令行中被解释为变量的开头
- bash - 根据bash中的关联数组值更新文件中的列
- echarts - 更改 eCharts 热图特定单元格中的边框宽度
- python - 从“if”语句将数据添加到空列表
- swift - Siri 消歧在 Xamarin.iOS SoupChef 示例项目中不起作用?