Gravs blueprint copy & paste examples

Because writing yaml files is totally pain in the arse (strict identation). I’ve decided to create snippet repository for blueprints.

List for carousel

Carousel slides in a form of header + text content

Header + text
form:
  fields:
    header.carousel:
      type: list
      label: Carousel
      fields:
        .header:
          label: Nagłówek
          type: text
          label: Header
          description: Nagłówek slajdu
        .text:
          label: Tekst
          type: editor
          description: Treść slajdu
          codemirror:
            mode: 'markdown'

How to output

In your template file:

 {% for s in header.carousel %}
    <div class="carousel-item text-center {% if loop.first %}active{% endif %}">
        {% set image = s.image ? page.media[s.image] : page.media.images|first %}
        <img src="{{ image.url }}" class="img-fluid"> 
    
        <div class="inner-content">
            <h3>{{ s.header }}</h3>
            <div class="text-content">
                {{ s.text }}
            </div>
        </div>

    </div>
 {% endfor %}