Ecom Store Pro

How do you edit the Shopify blog post template in code?

Published ·
At a glance
Short answer
In Edit code, templates/article.json (Online Store 2.0) names the post's section; that section's file and any theme blocks it renders hold the code.
Try first
Theme editor sections, Custom CSS, or a new template made in the editor — no theme code to edit
One post vs all
Section code reaches every template naming it; an alternate template's own editor changes reach only its posts
Template limit
1,000 templates per theme in total, blog post templates included
Before editing
Duplicate the theme; deleted theme files can't be recovered
Theme updates
If edits are incompatible, all code changes are removed from the updated copy; save a copy first

What can you change without editing code?

Shopify's code editor guidance says to edit theme code only if you can't make the change with a Shopify app or the theme editor. For posts, the editor covers three kinds of change:

  • Sections and blocks: add, remove or rearrange them on the blog post template.
  • Custom CSS: a setting on the theme and each section for changing your store's look without editing theme code.
  • A new template: made from an existing one, it starts with the same sections, and you can change it without affecting posts that use the original.

You then pick the new template in a post's Theme template field in your admin. Our blog setup guide walks through that editor route.

What should you do before you edit theme code?

Shopify advises editing code only if you know HTML and CSS and have a basic understanding of Liquid, and you can edit a paid theme's code only after you've purchased it.

Then duplicate the theme as a backup, so you can discard your changes and start again. If your theme library is full, make room before you duplicate.

Deleted theme files can't be recovered
Any theme file can be deleted, and a deleted file can't be recovered. The Timeline view restores one existing file at a time, replaces its whole contents, and keeps a finite history; asset files such as CSS, JavaScript and images have none.

Code edits that don't conflict with a theme update are included in it; if they're incompatible, all your code changes are removed in the updated copy. Shopify says to always save a copy of any customized code before updating your theme.

Shopify's theme-update page, read October 21, 2026, leaves files in the Templates folder out of its list of code changes and doesn't say what happens to an edited article.json. How your edits fare in a manual update is covered separately.

Where is the blog post template in the code editor?

On an Online Store 2.0 theme, a post page is built from a JSON template, and Shopify's article template documentation says its HTML or Liquid code has to live in a section the template references.

  1. From your Shopify admin, go to Online Store, open the theme's menu and click Edit code.
  2. In the Templates folder, open article.json for single posts; blog.json renders the blog page that lists all posts in a blog.
  3. Note which section the template names: it's the type value under sections, the section's filename without the extension.
  4. Check how to change only some posts, then open that section's file and edit it there; that changes every template naming the section. On themes with theme blocks, such as Horizon, part of the markup can sit in block files in the blocks folder, and editing one changes every section that uses that block. Theme Check underlines some errors, such as missing templates, in red as you type.
In Shopify adminOpen in your store
  1. Online Store
  2. Themes
  3. Edit code
Steps 2–3: the type under sections names the section to edit; the header warns changes may be overwritten.

The same documentation says the article template or a section inside it should include the article object and the comment form, added with the Liquid form tag.

If the Templates folder holds the article template as a Liquid file instead, the code sits in that template itself: a template exists as JSON or Liquid, never both, and Liquid templates can't be used with sections.

How do you give some posts a different layout?

Any change to a template affects every post that uses it, so to display some posts differently, you can give them an alternate template. Make one in the theme editor, as covered above, or add one in the code editor, named after a valid template type plus an optional suffix, as in Shopify's JSON template example of product.alternate.json beside product.json. The same rule gives a post template such as article.name.json.

Changes you make to an alternate template in the theme editor reach only its posts, but an edit to a section file isn't contained that way. A template made from article.json starts with the same sections, and sections are available to any template by default, so editing a shared section's file still changes posts on both templates. One way to keep code to some posts is to have the alternate template name a different section file.

You assign the template in a post's Theme template field, which lists only your current live theme's templates, so one you add only in a duplicate theme won't show until that theme is live.

If you add a section to the JSON by hand, it must exist in the theme, and a section without presets in its schema can't then be removed in the theme editor.

A theme can hold 1,000 templates in total across all template types, blog posts included, and once it reaches that limit you can't create new JSON templates.

Renaming or deleting a template needs the code editor; posts that used a deleted template show the default one until you assign another.

Related questions

Online store & themes
How do you set a focal point on an image in Shopify?

Click an image in Files, the theme editor or a product, then click its spot and Save; works on supported themes only.

October 15, 2026

Online store & themes
Do Shopify themes update automatically?

Partly: per Shopify's Help Center, Theme Store themes get automatic bug and security fixes and other updates are manual; uploaded themes get none.

Updated October 20, 2026

Plans & getting started
How do you customize the Shopify password page?

Edit the Password page in the theme editor; its message and password are set in Online Store > Preferences (private mode).

Updated October 20, 2026

Stay updated

Get notified about new articles

Subscribe to receive updates when we publish new Shopify guides and insights.