HTML5 template tags are meant to be completely inert as if the content doesn’t exist in the source but is that the case when Google crawls and then indexes a webpage?
Does anyone have any data that can prove one way or another that Google indexes or doesn’t index content within template tags? Template tags are great but I don’t want to use them if they adversely affect SEO
2
Answers
I was curious about this as well, as I was thinking about using the
<template>
tag as a form of server-side rendering or pre-rending some content that would be updated via AJAX/JS once the page is ready.I checked the Google Webmaster Tools Structured Data Tester to see if it would read microdata out of HTML tags that were placed inside the
<template>
tag.As you can see from the screenshot, it does seem to read the data that is inside the
<template>
tag. I wouldn’t consider this a verified answer, but it does suggest that the parser (at least when it comes to HTML microdata) doesn’t ignore content inside<template>
tags.I experienced something today that would confirm it does affect SEO.
I just received a warning from the Google Search Console about increasing 404 errors, and almost all URL in error are in that form:
/some-path/some-page/$%7Bconsent.infoURL%7D
.Once URL decoded, we can see that
${consent.infoURL}
is a variable I use in a template tag, on ahref
attribute:So Google Bot indeed follows links in
template
tags.