FoxLearn.JsonLd
1.0.0
See the version list below for details.
dotnet add package FoxLearn.JsonLd --version 1.0.0
NuGet\Install-Package FoxLearn.JsonLd -Version 1.0.0
<PackageReference Include="FoxLearn.JsonLd" Version="1.0.0" />
<PackageVersion Include="FoxLearn.JsonLd" Version="1.0.0" />
<PackageReference Include="FoxLearn.JsonLd" />
paket add FoxLearn.JsonLd --version 1.0.0
#r "nuget: FoxLearn.JsonLd, 1.0.0"
#addin nuget:?package=FoxLearn.JsonLd&version=1.0.0
#tool nuget:?package=FoxLearn.JsonLd&version=1.0.0
FoxLearn.JsonLd
It provides strongly-typed C# POCO classes for working with JSON and JSON-LD in .NET applications. These classes are designed to represent structured data and can be easily serialized for use in the <head> section of HTML pages, enabling better integration with search engines and other data consumers.
Features
- 🔍 Enhances SEO and search visibility
- ⚙️ Easy integration with ASP.NET Core applications
- 🧩 Supports custom schema definitions using Schema.org formats
Installation
Install via the .NET CLI:
dotnet add package FoxLearn.JsonLd
Or via the NuGet UI in Visual Studio by searching for FoxLearn.JsonLd
What is Schema.org?
Schema.org defines a standardized vocabulary of classes and properties used to describe real-world objects and services in a machine-readable format. It serves as a common framework for structured data across the web, helping search engines and other tools better understand and process content.
Where is Schema.org Used?
Websites
<br/><br/>
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.
<br/><br/>
Example:
<br/><br/>
Google Logo Structured Data
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
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",
};
var serializerOptions = new JsonSerializerOptions
{
WriteIndented = true,
AllowTrailingCommas = true,
ReadCommentHandling = JsonCommentHandling.Skip,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault,
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
};
string json = JsonLdSerializer.Serialize(org, serializerOptions);
Console.WriteLine(json);
Example Output
{
"@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."
}
To output JSON-LD in ASP.NET Core, you can use @Html.Raw(json)
.
License
This project is licensed under the MIT License.
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 (1)
Showing the top 1 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. |
GitHub repositories
This package is not used by any popular GitHub repositories.