nyhetsbrev
start
meny
statistik
filer
inställningar
Contributors:
  • Klobber
Last edited: 1/19/2023

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.

<ew-template />

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:

<ew-template />

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.

Related attributes
  • 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.
Examples
<ew-template />

<ew-template for-key="article-contents" />

<ew-template skip-keys="bottom-link" />

<ew-list />

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.

Related attributes
  • for-key: Used to set key when used as a stand alone tag
  • take: Desc
  • skip: Desc
Examples
<ul ew-list="image-link-slider">
<li>
<a ew-for-href="link">
<img ew-for-src="image" />
</a>
</li>
</ul>

<ew-list for-key="newslist">
<a ew-for-href="$">
<span>News</span>
<strong ew-for="$label"></strong>
</div>
</ew-list>

<ew-list for-key="coworkers" skip="2" take="6">
...
</ew-list>

<tag ew-for="key" />

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.

Sub-keys

The for-tag also allows for some variants for rendering contents as HTML attribute-value instead of inside the tag, such as ew-for-src, ew-for-href and ´´ew-for-attribute-XXX``.

Examples
<h2 ew-for="sub-title"></h2>

<p ew-for="articletext"></p>

<a ew-for-href="read-more"></a>

<img ew-for-src="main-image" />

This website uses cookies to improve your user experience, for security routines and for statistics. By continuing to use the website, you agree to the use of cookies.

This website uses cookies to improve your user experience, to provide a basis for improvement and further development of the website and to be able to direct more relevant offers to you.

Feel free to read ours privacy policy. If you agree to our use, choose Accept all. If you want to change your choice afterwards, you will find that option at the bottom of the page.

Cookies