Hide a Shopify Blog

Woman hiding behind sweater

Proofreading a high volume of blog articles involves many checks for accuracy and, perhaps, multiple proof­readers. Hiding work in progress is helpful.

Publish Insights 13 November 2021

Proofreading Categories

It is tough to produce an error-free story. In addition to human errors, autocorrect can throw in random words. So, in addition to proper formatting, you must proofread for different categories of errors.

  1. Evaluate value of the story.
  2. Verify continuity.
  3. Fix grammar, punctuation, and spelling.

First, is the story of any value to readers? If not, don’t waste time with other categories of proofing. Research may be necessary prior to writing. Continuity requires research and attention to details. Make certain names and places are consistent. Also be conscious of times, dates, verb tenses, and available technology for the plot. Now, dive into sentence flow, word choice, and formatting. Obviously, these steps require reading a story many times before publication.

You might compare article research to grocery shopping. You first need to acquire the essential ingredients. Groceries benefit from a good recipe or plot. With proper seasoning and plating, the end result is appealing to the eyes and taste.

Editing Text

Hide blog articles

Many people write articles in Rich Text Format (RTF) or Microsoft Word (DOCX) and paste them into a blog article portal. It may preserve most of the formatting but the underlying code can be messy and inconsistent with the overall style sheets for the website. Achieve better results by pasting plain text into the portal and applying appropriate style tags.

Microsoft Word has a built-in grammar checker. You might prefer a third-party tool like Grammarly. (Read terms of use and privacy policy.) Grammar checkers can catch errors you might miss. But they can also make suggestions that are inaccurate or disrupt the flow of your writing style.

Plain text editors like BBEdit are useful for global search-and-replace or coding. Among other things, I use a separate text editor for replacing non-breaking spaces.

Shopify displays a general sample within its blog article editor that hides HTML but excludes custom CSS styles. If you are like me, proofreading fully formatted text reveals more errors. The Preview option opens a page within a temporary new window. This is useful for analyzing the format.

Create a Hidden Directory

With the above options available, you may not need a hidden directory for proofreading. But if you produce a significant amount of articles that require several categories of proofing you may want to navigate through and compare fully-formatted text. For this, a blog directory that is hidden from search engines can be useful. Some bots will ignore instructions, but for the most part, site visitors will not have access.

Modify Liquid Code

Shopify is an e-commerce platform on which sellers build custom websites based on themes. Each theme adheres to similar underlying structure based on programming code called Liquid.

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.

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.

Come up with a simple name for your hidden blog. Here, we will name it Temp. The name you choose should also be the customer tag you add to allow you or others to view the temporary article. Now you access the Liquid programming code with Actions: Edit code. Use the instructions within the prior article named Shopify NoFollow Pages. Add a line to hide your new directory from robots.

{% if template == 'blog' and blog.title == 'Temp' -%}{{ nopin }}
{{ nobot }}

This keeps the search engines from displaying your unpublished content. Now you need to allow selective access to specific viewers, even if it’s just you. Near the top of the article template, use the following code to verify whether the visitor is logged in and has the appropriate customer tag. Modern Shopify themes have a category called Sections, beneath which you should modify the article template.

  {% comment %} // login status // {% endcomment %}
{%- assign logged_in = false -%}{%- if shop.customer_accounts_enabled and customer -%}{%- assign logged_in = true -%}{%- endif -%}
{%- if blog.title == 'Temp' and logged_in == false -%}{%- assign hide_content = true -%}{%- endif -%}
{%- if hide_content and customer.tags contains 'Temp' -%}{%- assign hide_content = false -%}{%- endif -%}

Further down, within the same template, find the container for the user content. It might be called article.content, user.content, or something else. Add an if condition that displays a message to unauthorized visitors else displays appropriate text.

  {% comment %} // hide or show article content // {% endcomment %}
{%- if hide_content -%}
  <div class="align-center">
    {%- if hide_content -%}
  <div class="align-center">
    <h2><strong>Login With Special Permission</strong></h2>
    <p>Page refresh may be necessary after <strong>{{ 'Login' | customer_login_link }}</strong></p>
{%- else -%}
  <div>{% comment %} // article.content // {% endcomment %}</div>
{%- endif -%}

Using the same {%- if hide_content -%} condition elsewhere within the article template, you can hide other elements of the article page. For example, you can hide social media share buttons.

Shopify now uses Cloudflare firewall but you can still create a personal account. Even the free account allows you to set up 5 firewall rules. The following may be useful for averting robots from scraping your temporary directory.

Cloudflare firewall block
With Cloudflare account, choose Firewall Rules to prevent known bots from accessing a directory.

If you have an onsite search feature, links to your hidden articles may appear within results without further code modifications. However, unauthorized visitors will not be able to access the articles when clicked. Keep articles within the hidden directory only long enough to complete thorough proofreading.

Read next article

'Interracial couple sitting on sofa'
'Female hand avoidance'