There are two types of linked snippet code. The first includes an element's data, such as a topic's details (for example, the contact topic). The second includes a page's code; it's only for store and product theme authors, and is covered in the Themes section.The first type uses the component's InvokeAsync call:@await Component.InvokeAsync("");
With data: loads an element's data or a widget zone's content. It takes two parameters:
1.
The component name, as a string: for example Widget or TopicBlock.
2.
The element's data, for example:
This uses the topic component by passing "TopicBlock" as the first parameter. The second parameter, created with new, selects the topic whose system name is HomepageText.HomepageText is the system name Emole stores use for the topic at the top of the home page: a banner, text, contact details, a message and so on.
Without data: loads a built-in section. Emole has many built-in sections, for example HomepageProducts lists the home page products and HomepageCategories lists the home page categories.
@await Component.InvokeAsync("HomepageCategories")
Some components work without the data parameter, and some require it.
Some components show a list of elements as a table or slider, such as HomepageCategories, HomepageProducts and HomepageBestSellers. Some show one element's details, and some show other things, such as the checkout progress or the shopping cart.
For components that show a list, filter it with the data parameter using the element's fields. For components that show a single element, such as TopicBlock, use a field like SystemName: most elements have one, such as topics and customer roles; others use fields like Name.
Components are resolved through a tree: the snippet first looks for the component in the current theme's components folder. If it isn't there, it looks in the Emole system's base components folder. If it isn't there either, the snippet doesn't work and shows an error.
A wrong component name shows nothing. A single-element component called without the data parameter may show nothing, or may show data you didn't intend.
The second type uses PartialAsync. It shows a page's code, such as a form, or includes one page inside another. It's covered in the Themes section.