Hey there, I'm looking for someone who is familiar with Shopify and can assist me.
I am currently trying to set up a secondary Blog section on a separate page from my default 'Blog Page', but I'm encountering issues in displaying the actual blog posts on the new page. All I seem to see is the page title, and I am unsure why that is happening. Ideally, I want specific articles based on their tags to be displayed, but for now, I would settle for showing all articles and then refine it later. Below is the code I am using for my blog titled Studio. Any help or guidance would be highly appreciated as I'm unable to identify where I might be going wrong.
<div class="page-width">
<header class="section-header text-center">
<h1>{{ page_title }}</h1>
{% if blog.tags.size > 0 %}
<select id="BlogTagFilter">
<option value="/blogs/{{ blog.handle }}">{{ 'blogs.article.all_topics' | t }}</option>
{% for tag in blog.all_tags %}
<option value="/blogs/{{ blog.handle }}/tagged/{{ tag | handleize }}" {% if current_tags contains tag %}selected{% endif %}>{{ tag }}</option>
{% endfor %}
</select>
{% endif %}
</header>
</div>
<div class="{% if section.settings.layout == 'list' %}blog--list-view{% endif %}">
// More HTML code goes here...
Thanks to those who have helped me thus far.
Could anyone confirm whether the below code should be included in my section template?
{% if blogs[section.settings.sidebar_blog].tags.size > 0 %}
{% for tag in blogs[section.settings.sidebar_blog].all_tags %}
{{ tag }}
{% endfor %}
{% endif %}
{% schema %}
{
"type": "blogs",
"id": "sidebar_blogs",
"label": "Blogs"
}
{% endschema %}
Upon attempting to save the updated section with the provided code above, I encounter the following errors:
Error: Invalid schema - 'type' is not a valid attribute. Error: Invalid schema - 'id' is not a valid attribute. Error: Invalid schema - 'label' is not a valid attribute.
Even when I use the alternative schema below instead of the previous one, I still face the same error messages:
{
"type": "blog",
"id": "sidebar_blog",
"label": "Blog"
}