Embed syntax basic

There two way to embed syntax:

  • Embed list of content into site.
  • Embed single content into site.

Embed list of content into site

Spear seek cms-loop attribute all of pages. If spear detect cms-loop, spear will fetch data resource.

In this case, you should specify the following attribute as well.

attributevalue typerequired or optiondescription
cms-loopN/A (No value)N/AThis is flag for displaying contents list
cms-content-typestringrequiredYou should specify the content type name

Loop element

Spear will repeat the all of element which has cms-loop.

For example, if we have the following HTML code, spear will repeate generating this element by content amount.

  • /src/index.html
...
<body>
  <ul>
    <li cms-loop cms-content-type="news">
      <h1>{%= blog_title %}</h1>
    </li>
  </ul>
</body>
  • generated html(/dist/index.html)
...
<body>
  <ul>
    <li>
      <h1>2021/10/10</h1>
    </li>
    <li>
      <h1>2021/10/11</h1>
    </li>
    <li>
      <h1>2021/10/12</h1>
    </li>
  </ul>
</body>

Embed single content into site.

This section is comming soon.