Nancy - Super Simple View Engine: How to override MasterPage header in View?
I would like to set the title of each displayed page from the corresponding view. I would also like to have a default title set on my main page. Here's a super simple setup I'm using.
Master page
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>NancyFX is Splendid</title>
</head>
<body>
@Section['Content']
</body>
</html>
View
@Master['_Master']
@Section['Content']
<h1>Home</h1>
<p>Hello @Model.UserName</p>
@EndSection
I've tried a few more obvious guesses, but so far there has been no joy. You can help?
On a more general note - is there any definitive help for the Nancy SSVE? I have read all the docs available on the site and GitHub, but they are scarce. Just a list of all the SSVE @ [] 'keywords would save me a lot of time.
thank
source to share
You can just render it from the model like everything else:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hello @Model.Name!</title>
</head>
<body>
<h1>Super Simple View Engine</h1>
<p>This text is in the master page, it has access to the model:</p>
<p>Hello @Model.Name!<p>
@Section['Content']
</body>
</html>
In terms of documentation, most of the tags are documented here: https://github.com/grumpydev/SuperSimpleViewEngine , although it is now a little outdated. It was originally designed for internal use only, but obviously you can use it if you like. The best place to look if you get stuck is tests, there are samples for all tags.
source to share