A simple example
This example shows how to create the most basic project.
You'll need to open a command prompt and have ocam.exe
available in your path.
Find a location for your project, chdir into the directory, and create these subdirectories:
- Layouts
- Site
Create a file called Layout.cshtml
in the Layouts
directory.
It should contain the following:
<!DOCTYPE html>
<head>
<title>@ViewBag.Title</title>
</head>
<body>
@RenderBody()
</body>
</html>
Next, create a file in the Site
directory called index.md
and add the following content:
---
Title = "My example index";
Layout = "Layout";
---
Hello, world!
To build the project, run the ocam
command in the project's base directory.
This will create an Html
subdirectory which contains a generated file called
index.html
that looks like this.
<!DOCTYPE html>
<head>
<title>My example index</title>
</head>
<body>
<p>Hello, world!</p>
</body>
</html>
That's it!