Question

I am currently adding microdata to an existing C# ASP.NET MVC3 project.

Here on Stackoverflow, I found an answer by Rui Jarimba to a question posted called "Writing microdata programatically (c# / ASP.NET) 4". He provides a very nice Visual Studio solution for adding HTML5 microdata to an application using metadata providers that I've been able to integrate and use in my solution.

My question is, does anyone know if anything like this exists as a framework or NuGet package? I have looked in NuGet and only see two packages of this type that are both for WebApi projects.

Thanks, Phillip

Was it helpful?

Solution

Try "MXTires Microdata .NET" NuGet Package. Use defined there classes then convert them to JSON-LD by calling ToJson() method. For instance:

 var offer = new Offer()
     {
         Name = "Accessory for your car.",
         Availability = ItemAvailability.InStock,
     };
offer.ToJason();   

The result should like this:

        <script type="application/ld+json">{
          "availability": "http://schema.org/InStock",
          "name": "Accessory for your car.",
          "@context": "http://schema.org",
          "@type": "Offer"
        }</script>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top