-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_json-ld.cshtml
31 lines (26 loc) · 946 Bytes
/
_json-ld.cshtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
@using Connect.Razor.Blade;
<div>
return to <a href="@Link.To()">overview</a>
</div>
<h1 class="sc-element">
Razor Blade - JSON LD Examples
@Edit.Toolbar(Content)
</h1>
@{
// example adding a json-ld as a string
HtmlPage.AddJsonLd("{ \"@context\": \"https://schema.org/\" }");
// creating a JSON-LD using an object - replicating googles example https://developers.google.com/search/docs/guides/intro-structured-data
var jsonLd = new Dictionary<string, object> {
{ "@context", "https://schema.org"},
{ "@type", "Organization"},
{ "url", "http://www.example.com"},
{ "name", "Unlimited Ball Bearings Corp."},
{ "contactPoint", new Dictionary<string, object> {
{"@type", "ContactPoint"},
{"telephone", "+1-401-555-1212"},
{"contactType", "Customer service"}
}}
};
HtmlPage.AddJsonLd(jsonLd);
}
This page adds 2 JSON-LD tags to the html-head. View the output source to see it.