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

    Convert a Shopify Section to a Block (Horizon Theme version)

    Convert a Shopify Section to a Block (Horizon Theme version)

    In Horizon, Shopify allows developers to convert standalone sections into reusable blocks, giving merchants even more control in the theme editor. Let’s walk through the process step by step.

    September 30, 20267 min
    Fixing 404 Errors on Shopify Using URL Redirects

    Fixing 404 Errors on Shopify Using URL Redirects

    By using Shopify’s URL Redirects, you can quickly fix 404 errors, maintain SEO rankings, and improve customer experience.

    September 24, 202610 min
    10 Essential Shopify SEO Tips to Boost Your Store's Traffic

    10 Essential Shopify SEO Tips to Boost Your Store's Traffic

    Optimize your Shopify store for search engines with these 10 actionable SEO tips, covering setup, keywords, on-page optimization, and technical fixes. Improve your store's visibility, drive more traffic, and increase sales. Get started with Shopify SEO today!

    August 16, 20263 min
    Adding a Smooth Back-to-Top Button to Your Shopify Theme

    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