How can I limit blog articles to 3 in DAWN theme?

Hello!

I have setup a section in DAWN Theme to have a collection of articles based on a blog tag.

It works fine, not perfect, but when I change the “tag” type, which I plan to change each month, I need to fiddle around with the “limit” articles to make sure it shows only 3 articles.

In some occasions, based on the tag type, if I limit “3” it won’t show any articles.

I have attached the code below:


  

    

      ## {{ section.settings.heading | escape }}

    

    {%- if section.settings.blog != blank and section.settings.blog.articles_count > 0 -%}
      

    {%- else -%}
      

        

          {{ 'image' | placeholder_svg_tag: 'placeholder-svg' }}
        

        
          ## 
            {{ 'sections.featured_blog.onboarding_title' | t }}
          
          

            {{ 'sections.featured_blog.onboarding_content' | t }}
          

        

      

    {%- endif -%}
  

All help will be so greatly appreciated.

Also is it possible to do a slider for desktop and ipad, not just mobile?

Thank you!

@thisislalalou

oh sorry for that issue can you please send full code its missing code


{{ 'section-featured-blog.css' | asset_url | stylesheet_tag }}

{%- style -%}
  .section-{{ section.id }}-padding {
    padding-top: {{ section.settings.padding_top | times: 0.75 | round: 0 }}px;
    padding-bottom: {{ section.settings.padding_bottom | times: 0.75 | round: 0 }}px;
  }

  @media screen and (min-width: 750px) {
    .section-{{ section.id }}-padding {
      padding-top: {{ section.settings.padding_top }}px;
      padding-bottom: {{ section.settings.padding_bottom }}px;
    }
  }
{%- endstyle -%}

{%- liquid
  assign posts_displayed = section.settings.blog.articles_count
  if section.settings.post_limit <= section.settings.blog.articles_count
    assign posts_exceed_limit = true
    assign posts_displayed = section.settings.post_limit
  endif
-%}

  

    

      ## {{ section.settings.heading | escape }}

    

    {%- if section.settings.blog != blank and section.settings.blog.articles_count > 0 -%}
      

    {%- else -%}
      

        

          {{ 'image' | placeholder_svg_tag: 'placeholder-svg' }}
        

        
          ## 
            {{ 'sections.featured_blog.onboarding_title' | t }}
          
          

            {{ 'sections.featured_blog.onboarding_content' | t }}
          

        

      

    {%- endif -%}
  

{% schema %}
{
  "name": "Featured Blog Tags",
  "tag": "section",
  "class": "section",
  "settings": [
    {
      "type": "text",
      "id": "heading",
      "default": "Featured Blog Tag posts",
      "label": "t:sections.featured-blog.settings.heading.label"
    },
    {
      "type": "blog",
      "id": "blog",
      "label": "t:sections.featured-blog.settings.blog.label"
    },
    {
      "type": "range",
      "id": "post_limit",
      "min": 2,
      "max": 4,
      "step": 1,
      "default": 3,
      "label": "t:sections.featured-blog.settings.post_limit.label"
    },
    {
      "type": "select",
      "id": "color_scheme",
      "options": [
        {
          "value": "accent-1",
          "label": "t:sections.all.colors.accent_1.label"
        },
        {
          "value": "accent-2",
          "label": "t:sections.all.colors.accent_2.label"
        },
        {
          "value": "background-1",
          "label": "t:sections.all.colors.background_1.label"
        },
        {
          "value": "background-2",
          "label": "t:sections.all.colors.background_2.label"
        },
        {
          "value": "inverse",
          "label": "t:sections.all.colors.inverse.label"
        }
      ],
      "default": "background-1",
      "label": "t:sections.all.colors.label",
      "info": "t:sections.all.colors.has_cards_info"
    },
    {
      "type": "checkbox",
      "id": "show_image",
      "default": true,
      "label": "t:sections.featured-blog.settings.show_image.label",
      "info": "t:sections.featured-blog.settings.show_image.info"
    },
    {
      "type": "checkbox",
      "id": "show_date",
      "default": true,
      "label": "t:sections.featured-blog.settings.show_date.label"
    },
    {
      "type": "checkbox",
      "id": "show_author",
      "default": false,
      "label": "t:sections.featured-blog.settings.show_author.label"
    },
    {
      "type": "checkbox",
      "id": "show_view_all",
      "default": true,
      "label": "t:sections.featured-blog.settings.show_view_all.label"
    },
    {
      "type": "header",
      "content": "t:sections.all.padding.section_padding_heading"
    },
    {
      "type": "range",
      "id": "padding_top",
      "min": 0,
      "max": 100,
      "step": 4,
      "unit": "px",
      "label": "t:sections.all.padding.padding_top",
      "default": 36
    },
    {
      "type": "range",
      "id": "padding_bottom",
      "min": 0,
      "max": 100,
      "step": 4,
      "unit": "px",
      "label": "t:sections.all.padding.padding_bottom",
      "default": 36
    }
  ],
  "presets": [
    {
      "name": "t:sections.featured-blog.presets.name",
      "settings": {
        "blog": "News"
      }
    }
  ]
}
{% endschema %}

Hi thanks for your time!