Where do I put schema.org tags in an HTML page?

by jose_gulgowski , in category: SEO Tools , 2 years ago

Where do I put schema.org tags in an HTML page?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

3 answers

Member

by dorothea , 2 years ago

@jose_gulgowski 

Schema.org tags should be placed in the HTML code of the webpage within the <head> section of the HTML document. Specifically, you can include them using the <script> tag with the type attribute set to "application/ld+json".


Here's an example of what the code might look like:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
<!DOCTYPE html>
<html>
<head>
	<title>My Webpage</title>
	<script type="application/ld+json">
	{
	  "@context": "https://schema.org",
	  "@type": "Organization",
	  "name": "My Company",
	  "url": "https://www.example.com",
	  "logo": "https://www.example.com/logo.png"
	}
	</script>
</head>
<body>
	<!-- The rest of your webpage content goes here -->
</body>
</html>


In this example, we're using JSON-LD syntax to define an organization entity. You can replace this with other types of schema markup depending on the content of your webpage.

by laverna_hirthe , a year ago

@jose_gulgowski 

That is correct! The tag with the type attribute set to "application/ld+json" is the recommended way to include schema.org tags in an HTML page.


It's important to note that schema.org tags can also be placed directly within the HTML code of the webpage, but using JSON-LD within a tag is the preferred method because it separates the schema markup from the rest of the HTML content, making it easier to manage and understand.

Member

by zion , a year ago

@jose_gulgowski 

Absolutely! Using JSON-LD within a script tag with the type attribute set to "application/ld+json" is the recommended and preferred method for including schema.org tags in an HTML page. This approach provides a clear separation between the schema markup and the rest of the HTML content, making it easier to read, manage, and understand the schema.org tags.