Configuration
Site.config
You may override defaults by including a Site.config
file in your project's base directory.
<?xml version="1.0" encoding="utf-8" ?>
<SiteConfiguration>
<IndexName>index.html</IndexName>
</SiteConfiguration>
Razor
Any .cshtml
files under the Site
directory will be loaded and
executed during the build process. Their contents will be rendered to the
Html
directory as an .html
file.
@{
Layout = "Main";
Title = "Home";
}
<h2>@Title</h2>
<p>Welcome!</p>
The backing class for these pages is the PageTemplate<>
class and the
model is PageModel
. This template has a set of properties that may be
set in the head section of the page. They include the following:
- Layout - The name of a template in the
Layouts
directory - Title - The title property sets the
ViewBag.Title
property, which may be accessed from layouts and includes - Date - A date to associate with this page. If the page is a post, setting Date overrides the date derived from the file path.
- Published - Set to
false
to prevent the page from being generated or included in page or post lists
Markdown
Any files with the extension .markdown
or .md
will be processed
as Markdown and the result will be stored under the Html
directory.
The front matter section may reference the same template properties as described above.
Here is the equivalent of the above page in Ocam flavored Markdown.
---
Layout = "Main";
Title = "Home";
---
@Title
===
Welcome!
_PageStart.cshtml
To avoid duplicating things at the head of every file, you may instead
create a _PageStart.cshtml
file in any directory under Site
.
If found, it will be used to initialize common properties for all
generated files under the given directory.
@{
Layout = "Main"
}
It serves much the same purpose as _ViewStart.cshtml
does in
the ASP.NET MVC environment.