Programming

Enable Selective Shopify RSS

RSS feed blocks

Hooray! RSS feeds for Shopify blogs are working. Manage multiple blogs on your site with a little Liquid programming code modification.

Publish Insights 19 March 2022

Data Feed

RSS stands for Really Simple Syndication. It is structured (XML) text with basic formatting. Hence, it ignores website scripts and custom CSS. Some webmasters use it to aggregate data from other sites into their own.

Affiliate influencer websites like Triberr utilize RSS feeds so members can amplify blog posts of others. An individual can use an RSS application to track new posts from websites and social media without visiting each site. Frankly, as a webmaster, you prefer visitors to your actual site over remote consumers of content.

Shopify RSS

HISTORY: When ClinicalPosters migrated to Shopify just prior to the year 2018, RSS was an abomination. By that, I mean it was not functioning. Attempts to link resulted in error messages because Google stopped supporting the default RSS called FeedBurner. A crude third-party app add-on was available for a monthly subscription. [1]

TODAY: I did not receive a memo when Shopify fixed RSS, but in 2022, it is functional. It lacks robust options like managing which elements are accessible but sometimes the target app is selective about the content it retrieves.

With RSS, it is possible to access any Shopify blog with the same .atom url extension. However, most visitors will not connect unless they see the familiar RSS icon.

Conforming to standards, your original Shopify theme developer should have already included an option to enable RSS feeds (display icon with link). If you have only one blog, the default level of control is sufficient. However, for multiple blogs, you may wish to hide the icon on one or more of your blogs by modifying the programming language called Liquid.

Programming

Before making modifications to your Shopify theme, it is good to duplicate it. Within Admin, under the lefthand navigation, choose Online Store: Themes. Click the menu for the active theme, Actions: Duplicate. Work on the duplicate and preview before activating when done.

Caution: Modifying Liquid code may invalidate your theme for future updates by the developer. Anything you add will require manual migration to a different theme, with possible incompatibility.

Now you access the Liquid programming code with Actions: Edit code menu. Within the Sections area, open your blog-template. (For older themes without a Sections area, open the article.liquid under the Templates section.)

Modify Conditional Display

Search for the word “RSS” to find the code that displays it to visitors. It will likely begin with {%- if section.settings…rss… -%}. Add the following unless condition:

{%- if section.settings.show_rss -%}
  {%- assign blog_lc = blog.title | downcase -%}
  {%- assign rss_exclude_lc = section.settings.rss_exclude | downcase -%}
  {%- unless rss_exclude_lc contains blog_lc -%}
    <a href="{{ blog.url }}.atom" target="_blank" class="Whatever-CSS-Style">{% render 'icon' with 'rss' %}</a>
  {%- endunless -%}
{%- endif -%}

Replace “Whatever-CSS-Style” with appropriate style for your site theme.

Notice that I assigned new lowercase names for the blog title and exclusions so you don’t have to worry about a case-sensitive mismatch. Now we need to add the rss_exclude within the blog schema. This will allow you to list the blog titles for exclusion from within the Customize theme options for blogs.

Modify Blog Options UI

Scroll down to the bottom of the same blog.template you are working on and locate the RSS option. It this case it is entitled show_rss. (The actual id will vary across different themes. It might, for example, say enable_rss.) Beneath the schema, add the five lines of code (lines 7–12) for rss_exclude:

{
  "type": "checkbox",
  "id": "show_rss",
  "label": "Show RSS",
  "default": false
},
{
  "type": "text",
  "id": "rss_exclude",
  "info": "Comma separated blog titles",
  "label": "Exclude blogs"
},

Enable RSSAfter saving the template, exit to type a list the blog titles for exclusion. You can jump there by clicking the Customize Theme button in the upper right corner or exit the coding environment and click the Customize button. As the info says, comma separate titles. When enabled, the RSS logo will appear on remaining blogs.

Read next article

'Female podcaster'
'Female squinting to read'