Solved

Why isn't the doctype declared in my Shopify liquid theme files?

Vvel
Explorer
121 2 12

In my liquid.themes files its been there as shown below. Why isn't it declared?

-----‐-----------

{% render 'breadcrumbs' %}
{% capture content %}
<!DOCTYPE html>
<html>
<!--[if lt IE 7 ]><html class="ie ie6" lang="{{ shop.locale }}"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="{{ shop.locale }}"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="{{ shop.locale }}"> <![endif]-->
<!--[if IE 9 ]><html class="ie ie9" lang="{{ shop.locale }}"> <![endif]-->
<!--[if (gte IE 10)|!(IE)]><!--><html lang="{{ shop.locale }}"> <!--<![endif]-->
<head>

Accepted Solution (1)
KieranR
Shopify Partner
333 27 115

This is an accepted solution.

Just trying to guess what is tripping up SEMrush because their docs are not super clear: 

KieranR_0-1620016923717.png

But it looks like you have doctype dec correct anyway, so I wouldn't worry too much about what SEMrush is saying there. Maybe try reach out to SEMrush support out of curiosity if you wanna find out how they are parsing it and flagging a warning.

 

Full time Shopify SEO guy, based in NZ. Sometimes freelance outside the 9-5.

View solution in original post

Replies 5 (5)

KieranR
Shopify Partner
333 27 115

Where are you seeing this warning? Check what's getting output in view-source HTML.

Full time Shopify SEO guy, based in NZ. Sometimes freelance outside the 9-5.
Vvel
Explorer
121 2 12

https://prnt.sc/126twcu

And its from SEM Rush report

KieranR
Shopify Partner
333 27 115

So SEMrush audit/report only looks at static content. View-source & inspect element are different in Chrome. First is static content, second is rendered DOM. 

KieranR_0-1619993461485.png

^screenshot is of view-source.

It looks like you have two tags: 

  1. <!DOCTYPE html> 
  2. <html>

I'm guessing that SEMrush is just flagging (2). Ideally you would only have a single opening tag so not sure what's happening there, but try cleaning that up.

Also not related but somehow there is some JSON-LD which has been added outside of the <html> tag. More correct to place this within the head or body.

Full time Shopify SEO guy, based in NZ. Sometimes freelance outside the 9-5.
Vvel
Explorer
121 2 12

Ok ill put those script under the doctype.

For the 2nd html, that was added after the seo report. I thought you were supposed to have it as this https://www.w3schools.com/tags/tag_doctype.asp

 

KieranR
Shopify Partner
333 27 115

This is an accepted solution.

Just trying to guess what is tripping up SEMrush because their docs are not super clear: 

KieranR_0-1620016923717.png

But it looks like you have doctype dec correct anyway, so I wouldn't worry too much about what SEMrush is saying there. Maybe try reach out to SEMrush support out of curiosity if you wanna find out how they are parsing it and flagging a warning.

 

Full time Shopify SEO guy, based in NZ. Sometimes freelance outside the 9-5.