【发布时间】:2017-03-20 11:00:15
【问题描述】:
我正在构建一个 Web 应用程序,并使用 Nancy 和 Super Simple 视图引擎为用户呈现内容。由于许多页面具有相同的布局(标题、侧边菜单等),因此我在母版页中分离了可重复使用的内容。
目前我有
--Root_file (Master page)
--Home
--Products
--Contact
--Account (Master page)
--Overview
--Manage
--Post
root_file 下的所有文件都有一个@Master['root_file.html'] 引用。 Account 下的所有文件都有一个@Master['account.html']。
现在我的问题是,对于帐户下的管理,我想将 js 脚本设置为附加标头。我想,通过引用顶级母版页中的标签,我可以通过引用添加js。
这是一个概述。
Root_file.html
<head>
<title>Nice little title.</title>
@Partial['PartialView/header_references.html']
@Section['Additional_headers'];
</head>
<body>
@Section['Content'];
</body>
account.html
@Master['root_file.html']
@Section['Content']
<div class="container">
<div class="row justify-content-center">
@Partial['PartialView/side_menu.html']
<div class="col p-3">
@Section['Inner_content'];
</div>
</div>
</div>
@EndSection
manage.html
@Master['account/overview.html']
@Section['Additional_headers']
<script src="../../../Content/scripts/file-upload.js"></script>
@EndSection
我希望我可以通过嵌套母版页设置@Section[Additional_headers],但结果并没有反映我的希望。
是我做错了什么,还是不能设置这样的部分?
【问题讨论】:
标签: nancy viewengine