Blog Filter & Articles Search

Elevate your Shopify store's blog experience with our tailored Blog Filter & Articles Search customization, designed to enhance content discoverability without the need for external apps.

Blog Filter & Articles Search
1 sections

Blog Filter

We will guide you on how to create the Blog filter by Article tag

  • Step 1
  • From Shopify Admin Dashboard > Online Store > Themes > ... button > Edit code

  • Step 2
  • Search or Scroll the file list on the left to find the file name "main-blog.liquid" within Snippets. (Depending on your store's theme, it will have different files. We will guide based on Dawn theme structure) .

  • Step 3
  • Add the code below to the line#24

    code
    {% if blog.tags.size > 0 %}
          <div class="blog-filter">
            <div class="list-group">
              <ul id="BlogTagFilter" class="tag-list" style="display: flex; gap: 20px;">
                <li>Filter by:</li>
                {% if request.path contains 'tagged' %}
                  {% assign filter_name = request.path | split: 'tagged/' %}
                  {{ filter_name[1] | replace: '-', ' ' | capitalize }}
                {%  else %}
                  <li>
                    <a href="{{ blog.url }}" class="button">
                      {{ 'All Topics' }}
                    </a>
                  </li>
                  {% for tag in blog.all_tags %}
                  <li>
                    <a href="{{ blog.url }}/tagged/{{ tag | handleize }}" class="button">
                    {{ tag }}
                    </a>
                  </li>
                  {% endfor %}
              {% endif %}
              </ul>
            </div>
          </div>
        {% endif %}

  • Step 4
  • Also you can add CSS style, it's additional

    css
    <style>
      .list-group {
        text-align: center;
      }
      ul#BlogTagFilter {
    	list-style: none;
    	padding-top: 10px;
    	}
      ul#BlogTagFilter li {
    	display: inline;
        margin: 5px;
    	}
    </style>

    If you want show this tag on each Article card on Blog page, let use the code:

    code
    <ul>
          {% for tag in article.tags %}
            <li><a href="{{ blog.url }}/tagged/{{ tag | handleize }}" class="button">{{ tag }}</a></li>
          {% endfor %}
    </ul>

    Using below code

    css
    <form method="get" action="/search">
        <input type="hidden" name="type" value="article" />
        <input type="text" name="q" />
        <input  type="submit" value="Search" />
    </form>
    Tags

    Related Articles

    Adding a Smooth Back-to-Top Button to Your Shopify Theme
    Tips & Tricks

    Adding a Smooth Back-to-Top Button to Your Shopify Theme

    Learn how to add a smooth back-to-top button to your Shopify theme using lightweight CSS and JS, improving navigation and enhancing user experience.

    August 13, 20263 min
    Shopify Requires Expiring Offline Access Tokens for Public Apps: What Developers Need to Know
    Tips & Tricks

    Shopify Requires Expiring Offline Access Tokens for Public Apps: What Developers Need to Know

    Shopify is making an important change to how public apps authenticate with the Admin API

    August 8, 202630 min
    Understanding Shopify Theme Check: LiquidHTML/Complexity
    Tips & Tricks

    Understanding Shopify Theme Check: LiquidHTML/Complexity

    Although this isn't a compilation or runtime error, it's an important indicator that your Liquid file has become too complex, making it harder to read, maintain, and extend over time

    July 30, 202620 min
    Migrating from PrestaShop to Shopify
    Tips & Tricks

    Migrating from PrestaShop to Shopify

    Migrating an e-commerce store from an open-source platform like PrestaShop to a hosted SaaS solution like Shopify is a common step for growing businesses looking to simplify store management and infrastructure overhead.

    July 24, 202615 min