How to use it
There are a few steps involved in getting Anakia working. First you need to create the content documents which are simple xml files. The structure is up to you. Then you create a transformation file, which uses NVelocity syntax. A project file can be used to define the project menu and content that is used by all pages. Finally an optional navigation file can be added to each folder, to define a contextual navigation.
It is assumed that you have a recent version of NAnt installed and configured on your environment.
The files
The sections below explain the files and their roles. Bear in mind that they are most a convention than something enforced by the tool. From Anakia point of view, their are just xml content. It's up to you to make everything work.
The content files
Each content file defines a content that ultimately will be transformed to a html page. It's up to you to define the structure, as long as the transformation file matches that structure when transforming the content to html.
Castle Anakia site map implementation assumes that you use sections, which can be nested up to three levels. Castle web site uses the structure depicted below:
<?xml version="1.0"?> <document> <properties> <title>Page title</title> </properties> <body> <intro> <p>Some paragraphs with an introductory explanation</p> </intro> <section id="an optional id"> <title>The section title</title> <p>Section content paragraph 1</p> <p>Section content paragraph 2</p> <section> <title>A sub section</title> <p>Another paragraph</p> </section> </section> </body> </document>
The index file
The index.xml file is a content file that is treated differently by Castle Anakia when generating breadcrumbs and sitemaps. The folder title for example is get from the index.xml title property.
The project file
The project.xml file should contain information that is shared by all content pages. For example common links, or a default menu structure.
The navigation file
The navigation.xml file can appear on each folder and should contain contextual information for the folder and subfolders. For example, it can override the menu, or enhance the navigation.
The transformation file
The transformation file is a NVelocity template that needs to transverse the xml document and generate the final html.
Creating a NAnt target
Once you have some content files, the project.xml and the transformation file, you should set a NAnt target to run Castle Anakia. The following is an example of a simple build file used by Castle:
<?xml version="1.0"?> <project name="castle-website" default="run"> <loadtasks assembly="../AnakiaNet/Anakia/bin/Anakia.dll" verbose="true" /> <target name="run"> <anakia navigationfile="navigation.xml" templatefile="site.vsl" projectfile="project.xml" targetdir="website" > <source basedir="xdocs"> <include name="**.*" /> <exclude name="**/project.xml" /> <exclude name="**/*.vsl" /> <exclude name="**/*.dtd" /> </source> </anakia> </target> </project>
When running NAnt you should have something like the following output:
NAnt 0.85 (Build 0.85.2344.0; rc4; 6/2/2006) Copyright (C) 2001-2006 Gerry Shaw http://nant.sourceforge.net Buildfile: file:///site/default.build Target framework: Microsoft .NET Framework 1.1 Target(s) specified: run [loadtasks] Scanning assembly "Anakia" for extensions. run: No index.xml found for folder castle/container/microkernel No index.xml found for folder castle/container/microkernel/documentation BUILD SUCCEEDED Total time: 0.9 seconds.
Only xml files will be processed. All others that match NAnt file set is considered a static file and will be copied to the target folder if a change is detected (source file is newer than target file).
If you want to skip files, use the exclusion on the file set definition.