Skip to content

Instantly share code, notes, and snippets.

@marioloncarek
Created December 14, 2018 17:06
Show Gist options
  • Save marioloncarek/7f6c1e11b00b80136c00baf128e15b60 to your computer and use it in GitHub Desktop.
Save marioloncarek/7f6c1e11b00b80136c00baf128e15b60 to your computer and use it in GitHub Desktop.
shopify blog blocks - not good
<div class="o-container">
<div class="o-row o-row--wide">
<div class="p-blog">
{% for block in section.blocks %}
<div class="p-blog__blocks single-category-block category-{{ block.settings.blog_category }}">
<div class="single-category-block__header">
{% for tag in blog.all_tags %}
{% if block.settings.blog_category contains tag %}
<h2 class="u-a7 u-uppercase">
{{ tag | link_to_tag: tag }}
</h2>
{% endif %}
{% endfor %}
<a href="{{ section.settings.link-two }}"
class="c-underline-button single-category-block__header-button">
<span class="c-underline-button__text">View All</span>
<span class="c-underline-button__arrows">
{%- include "icon-arrow" -%} {%- include "icon-arrow" -%} </span>
</a>
</div>
<div class="single-category-block__articles">
{% for article in blogs.men.articles limit:4 %}
{% if article.tags contains block.settings.blog_category %}
<div class="single-category-article">
<div class="single-category-article__image"
style="background-image: url('{{ article.image | img_url: '600x' }}')">
</div>
<div class="single-category-article__data">
{{ article.tags }} {{ article.published_at | date: "%B %d %Y" }}
</div>
<div class="single-category-article__title u-a1">
<a href="{{ article.url }}">{{ article.title }}</a>
</div>
</div>
{% endif %}
{% endfor %}
</div>
</div>
{% endfor %}
</div>
</div>
</div>
{% schema %}
{
"name": "Mens Blog blocks",
"settings": [
],
"blocks": [
{
"type": "select",
"name": "Blog Category",
"settings": [
{
"type": "text",
"id": "blog_category",
"label": "Blog category"
}
]
}
],
"presets": [
{
"name": "Mens Blog blocks",
"category": "Blog",
"blocks": [
{
"type": "select"
}
]
}
]
}
{% endschema %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment