Fork me on GitHub

Ocam

Razor and Markdown static site generator

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:

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.