Tags & attributes
The Easyweb Site-template is designed to print content from the Easyweb cloud in a HTML-friendly and simple manner. This chapter describes the different tags and attributes available for controlling content and how it's rendered.
The template-tag will automatically print any content found in its scope according to the way the underlying component of the content is coded to act. This is useful for building sites with more dynamic content, where the site can automatically print content as it is added to the Easyweb Studio. When more detailed control of how the content is displayed, this tag is usually avoided.
Since all components output are overridable, and the simplest component is a .cshtml-view with a matching key, you can leverage the template-tag to automatically print partial views corresponding to the keys you've added.
For example, given a view
Views/Index.cshtml, which would act as a catch all fallback view, only containing:
You could add partial views like ``main-content.cshtml´´ or ´´sub-content.cshtml´´ with your actual HTML-markup written specifically for such keys, and then use the studio to specify different view-types and let them share the code using those keys.
If the template-tag is trying to print a key that doesn't find a corresponding partial view to render, it might fallback to print default content. What the underlying component will print as fallback depends on what content type is being printed. For example, an image will print an img-tag, a link will print an anchor tag, etc.
for-key: Only prints the component matching the given key.
skip-keys: Prints all immediate children except those with keys set in the attribute. Comma-separate for multiple keys.
<ew-template for-key="article-contents" />
<ew-template skip-keys="bottom-link" />
The list-tag iterates through the content defined by its key. Can be used as stand alone tag combined with
for-key or as attribute on any HTML-tag with desired key set as value.
The tag is used to list both components that allow multiple input and components that contain other list-data, such as article lists.
for-key: Used to set key when used as a stand alone tag
<img ew-for-src="image" />
<ew-list for-key="coworkers" skip="2" take="6">
The for-tag is used to render simple, single non-complex values. When used as attribute on any HTML-tag, the value of the key will be rendered inside the tag.
The for-tag also allows for some variants for rendering contents as HTML attribute-value instead of inside the tag, such as
ew-for-href and ´´ew-for-attribute-XXX``.
<img ew-for-src="main-image" />