FoxLearn.JsonLd
1.1.3
dotnet add package FoxLearn.JsonLd --version 1.1.3
NuGet\Install-Package FoxLearn.JsonLd -Version 1.1.3
<PackageReference Include="FoxLearn.JsonLd" Version="1.1.3" />
<PackageVersion Include="FoxLearn.JsonLd" Version="1.1.3" />
<PackageReference Include="FoxLearn.JsonLd" />
paket add FoxLearn.JsonLd --version 1.1.3
#r "nuget: FoxLearn.JsonLd, 1.1.3"
#:package FoxLearn.JsonLd@1.1.3
#addin nuget:?package=FoxLearn.JsonLd&version=1.1.3
#tool nuget:?package=FoxLearn.JsonLd&version=1.1.3
๐ท FoxLearn.JsonLd - Structured Data for .NET
FoxLearn.JsonLd is a lightweight .NET library that provides strongly-typed C# POCO classes for working with JSON-LD and Schema.org structured data. It enables easy serialization of semantic metadata in your web applications to boost SEO, enhance search engine visibility, and improve content discoverability.
โ Key Features
- ๐ SEO Optimization: Easily embed structured metadata into your HTML to power rich results on Google, Bing, and more.
- ๐ง ASP.NET Core Integration: Generate JSON-LD output directly from your backend logic.
- ๐งฉ Schema.org Support: Full support for Schema.org types like Organization, WebSite, WebPage, BreadcrumbList, and more.
- ๐ฆ Clean Serialization: Output standards-compliant JSON-LD using System.Text.Json.
๐ฅ Installation
Install via the .NET CLI:
dotnet add package FoxLearn.JsonLd
Or search for FoxLearn.JsonLd in the NuGet UI inside Visual Studio.
๐ What is Schema.org?
Schema.org is a collaborative community that creates, maintains, and promotes schemas for structured data on the Internet. Search engines like Google, Bing, Yandex, and Yahoo use this data to improve search listings with rich results such as:
Product ratings
Event details
Course listings
Breadcrumbs
Organization contact info
๐ Where is Schema.org Used?
Websites
Structured data based on Schema.org can be embedded in the <head> section of HTML pages to enable search engines to display rich, enhanced results. For example, Google may show extended metadata about your website directly in search results when structured data is present.
Example:
To include structured data in an HTML page, you can use a <script>
tag with the MIME type application/ld+json
.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Organization",
"url": "https://foxlearn.com",
"name": "FoxLearn",
"contactPoint": {
"@type": "ContactPoint",
"telephone": "+1-400-444-1711",
"contactType": "Customer service"
}
}
</script>
This allows search engines like Google to better understand your content and display enhanced search results accordingly.
๐งช Usage Guide
โ Basic Example: Organization
using FoxLearn.JsonLd;
using FoxLearn.JsonLd.Schema;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Text.Json.Serialization;
var org = new Organization()
{
Name = "FoxLearn",
Url = new Uri("https://foxlearn.com"),
LegalName = "FoxLearn",
Logo = new Uri("https://foxlearn.com/img/logo.png"),
Description = "Welcome to foxlearn.com! This site is a blog about everything that matters in the world of programming.",
ContactPoint = new List<ContactPoint>()
{
new ContactPoint() { ContactType = "Customer Service", Name = "Tan Lee", Email = "example@gmail.com"}
},
Founder = new List<IPerson>()
{
new Person() { Name = "Tan Lee"}
},
FoundingDate = new Date(2016, 01, 01),
Email = "example@gmail.com",
};
string json = JsonLdSerializer.Serialize(org);
Console.WriteLine(json);
Embed in your Razor view:
@Html.Raw(json)
This outputs:
{
"@type": "Organization",
"email": "example@gmail.com",
"founder": {
"@type": "Person",
"name": "Tan Lee"
},
"foundingDate": "2016-01-01",
"legalName": "FoxLearn",
"contactPoint": {
"@type": "ContactPoint",
"email": "example@gmail.com",
"contactType": "Customer Service",
"name": "Tan Lee"
},
"logo": "https://foxlearn.com/img/logo.png",
"url": "https://foxlearn.com",
"name": "FoxLearn",
"description": "Welcome to foxlearn.com! This site is a blog about everything that matters in the world of programming."
}
๐ Advanced Usage: Rich Page Metadata
Here's a more complex example using SchemaRoot to generate structured data for a full web page including images, breadcrumbs, and actions.
var root = new SchemaRoot();
var page = new WebPage()
{
Id = "https://foxlearn.com/course/asp-net-core-tutorials/",
Url = new Uri("https://foxlearn.com/course/asp-net-core-tutorials/"),
Name = "ASP.NET Core Tutorials For Beginners",
IsPartOf = new WebSite()
{
Id = "https://foxlearn.com/#website"
},
PrimaryImageOfPage = new ImageObject()
{
Id = "https://foxlearn.com/course/asp-net-core-tutorials/#primaryimage"
},
Image = new ImageObject()
{
Id = "https://foxlearn.com/course/asp-net-core-tutorials/#primaryimage"
},
ThumbnailUrl = new Uri("https://foxlearn.com/wp-content/uploads/2025/01/ASP.NET-Core-Tutorials-1.png"),
DatePublished = new Date("2025-01-12T04:04:22+00:00"),
Description = "These ASP.NET Core Tutorials are designed for beginners as well as professionals developers who want to learn ASP.NET Core.",
Breadcrumb = new BreadcrumbList()
{
Id = "https://foxlearn.com/course/asp-net-core-tutorials/#breadcrumb"
},
InLanguage = "en-US",
PotentialAction = new ReactAction()
{
Target = new Uri("https://foxlearn.com/course/asp-net-core-tutorials/")
}
};
root.Graph.Add(page);
ImageObject image = new ImageObject()
{
Id = "https://foxlearn.com/course/asp-net-core-tutorials/#primaryimage",
Url = new Uri("https://foxlearn.com/wp-content/uploads/2025/01/ASP.NET-Core-Tutorials-1.png"),
ContentUrl = new Uri("https://foxlearn.com/wp-content/uploads/2025/01/ASP.NET-Core-Tutorials-1.png"),
InLanguage = "en-US",
Width = 908,
Height = 203,
Caption = "ASP.NET Core Tutorials For Beginners and Professionals"
};
root.Graph.Add(image);
BreadcrumbList breadcrumb = new BreadcrumbList()
{
Id = "https://foxlearn.com/course/asp-net-core-tutorials/#breadcrumb",
ItemListElement = new[]
{
new ListItem() { Position = 1, Name = "Home", Item = new Uri("https://foxlearn.com") },
new ListItem() { Position = 2, Name = "Courses", Item = new Uri("https://foxlearn.com/courses/") },
new ListItem() { Position = 3, Name = "ASP.NET Core Tutorials For Beginners and Professionals" },
}
};
root.Graph.Add(breadcrumb);
WebSite webSite = new WebSite()
{
Id = "https://foxlearn.com/#website",
Url = new Uri("https://foxlearn.com"),
Name = "FoxLearn",
InLanguage = "en-US",
Publisher = new Person()
{
Id = "https://foxlearn.com/#/schema/person/072a2d877405716353aa607e372bc216"
},
PotentialAction = new SearchAction()
{
Target = new EntryPoint()
{
UrlTemplate = "https://foxlearn.com/post/search/?q={search_term_string}"
},
QueryInput = new PropertyValueSpecification()
{
ValueRequired = true,
ValueName = "search_term_string"
}
}
};
root.Graph.Add(webSite);
string json = JsonLdSerializer.Serialize(root);
Console.WriteLine(json);
๐ Benefits of Using FoxLearn.JsonLd
Better search performance: Appear in Google's rich cards and knowledge panels.
Higher click-through rates: Enhanced listings draw more attention.
Semantic clarity: Improve how your content is interpreted by AI tools and bots.
Clean, reusable code: Avoid manual JSON construction and validation.
๐ License
This project is licensed under the MIT License. Free for personal and commercial use.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- System.Text.Json (>= 8.0.5)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on FoxLearn.JsonLd:
Package | Downloads |
---|---|
FoxLearn.AspNetCore.JsonLd
A lightweight .NET library that automatically inserts <script> tags with the MIME type application/ld+json into the <head> of your HTML to help search engines better understand and index your content. |
|
FoxLearn.AspNet.JsonLd
A lightweight .NET library that automatically inserts <script> tags with the MIME type application/ld+json into the <head> of your HTML to help search engines better understand and index your content. |
GitHub repositories
This package is not used by any popular GitHub repositories.