How to Fix pages don't have doctype declared in Shopify

What is Doctype?

DOCTYPE is a declaration at the beginning of an HTML document that specifies the version of HTML or XHTML that the document is written in.

In HTML5, the doctype declaration is simply:

<!DOCTYPE html>

This declaration tells the web browser that the document is written in HTML5 and that it should be rendered according to the HTML5 specifications.

In earlier versions of HTML, the doctype declaration was more complex, specifying the document type definition (DTD) to be used. For example, the doctype declaration for HTML 4.01 Transitional was:

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>

The doctype declaration is an important part of an HTML document because it ensures that the document is rendered correctly in different web browsers.

How to fix have doctype declared in Shopify?

As you can see in the below image the Html Code starts with <html. It means there is no doctype declared before starting the HTML file

image 2

Here are the steps to fix the missing doctype for the Shopify store.

Step 1:- Open Your Shopify Dashboard

Step 2:- Search for theme.liquid in the theme search box

image 3

Step 3:- Paste the given code above the <html file

<!doctype html>
image 4

Like this And then save the file

image 5

Once you have saved the file Check the Source Code of your website to Verify.

As you can see in the below image the Doctype is clearly visible for the store.

image 6

Done!

Also Check:- Guide: How to create robots.txt file Shopify

If you are still facing any issues drop us an email on admin@digitalashmit.com

Leave a Reply

Your email address will not be published. Required fields are marked *

2 replies on “How to Fix pages don’t have doctype declared in Shopify”