-
Notifications
You must be signed in to change notification settings - Fork 0
Source files
Source files are placed in the content directory of your project, must be in XML format, and must have an extension of .xml so that Salal can identify them. Here is a simple example:
content
|__index.xml
|__subdirA
|__index.xml
|__subdirB
|__index.xml
A simple source file might look something like this:
<page>
<event-listing name="Battle of the Banjoes"
year="2021" month="04" day="17"
location="123 Main St, Acme AZ, USA"
price="$15 general admission, $10 students and seniors">
The best banjo players in the state go head-to-head for the coveted Golden Fingerpicking Award.
</event-listing>
</page>
All XML elements in the source file must have a corresponding template, so in this case your project will need to have a page template and an event-listing template. See the Templates page for details. Note that the event-listing element is the content of the page element. The content of your elements can either be one or more subelements, or some text, or both. For example, the content of the event-listing element is the text beginning with The best banjo players in the state. Like with regular HTML, you can mix text and subelements in your content. So, this would be okay:
<page>
<event-listing/>
<event-listing/>
</page>
As would this:
<page>
Here is some text content.
Here is some more text content.
</page>
And also this:
<page>
Here is some text content.
<event-listing/>
</page>
Note that because each XML element must have a corresponding template, you can't use regular HTML tags like <h1> or <p> in your source files - unless you also create a template for them. This can actually be quite useful, as it allows you to override the default styling associated with those tags while keeping the semantics. See Templates for an example of this.
- Home
- About Salal
- Installation
- Tutorials
- Core concepts
- Getting more out of Salal
- Advanced topics
- Change log