Scheduling sections based on blog post visibility

Highlighted
New Member
1 0 0

I'm looking to create several different homepage sections that toggle between display:none and display:block depending on if a specific blog post is visible or hidden as a way to schedule banners when there is new blog posts posted.

I've found a couple posts about scheduling homepage banners that touched on this idea but I can't seem to get it to work. I can't seem to figure out how to reference a specific blog post handle, I tried putting this code in the index.liquid file but it isn't working:

{% if article.handle == 'a-test-blog-post' and article.published_at == blank %} 
  <style>
#shopify-section-1566575073847 {
        display: none; }
  </style>
 {% else %}
    <style>
#shopify-section-1566575073847 {
        display: block; }
  </style>
{% endif %}

 

Anyone have any specific advice on where/how to reference this? Thanks!

0 Likes