SeoTags


SeoTags create all SEO tags you need such as meta, link, twitter card (twitter:), open graph (og:), and JSON-LD schema (structred data)..

What is JSON-LD


Structured data is an advanced SEO topic that is a standardized format for providing information about a page and classifying the page content.
Google uses structured data to understand the content on the page. You can help us by providing specific information about your site, which can help your site display in richer features in search results.
Google search supports structured data in the three formats: JSON-LD (Recommended), Microdata and RDFa.
Google recommends using JSON-LD for structured data whenever possible.
If you are not familiar with Structred Data and JSON-LD read these linked pages.
Google has a gallery of examples and also here are the most popular examples of JSON-LD such as Article, Product, Organization, and etc...
There are some JSON-LD schema markup generators here and here which may help you to understand the format of JSON-LD.

JSON-LD (Nested Example)


SeoTags now supports popular JSON-LD types such as Article, Product, Book, Organization, WebSite, WebPage, and etc...
This example shows JSOLD-LD in a nested values usage.

Usage Code

Initialize your JSON-LD data and add it to SeoInfo.JsonLD object by calling appropriate Add() method for example (AddProduct, AddArticle, AddOrganization, etc...)

var product = new ProductInfo
{
    Url = "https://site.com/product-url/",
    Name = "Product Name",
    AlternateName = "Product AlternateName",
    Description = "Product Description",
    Category = "Product Category",
    Identifier = "12345",
    Brand = new BrandInfo
    {
        Name = "Brand Name"
    },
    Images = new[]
    {
        new ImageInfo()
        {
            Url = "https://site.com/uploads/image-1.jpg",
            Caption = "Image Name",
            InLanguage = "en-US",
            Width = 1280,
            Height = 720
        },
        new ImageInfo()
        {
            Url = "https://site.com/uploads/image-2.jpg",
            Caption = "Image Name 2",
            InLanguage = "en-US",
            Width = 1280,
            Height = 720
        }
    },
    AggregateRating = new AggregateRatingInfo()
    {
        BestRating = 5.0,
        WorstRating = 1.0,
        RatingValue = 4.5,
        RatingCount = 123,
    },
    Reviews = new[]
    {
        new ReviewInfo()
        {
            BestRating = 5.0,
            WorstRating = 1.0,
            RatingValue = 4.5,
            Description = "Review Description 1",
            AuthorName = "Review Author 1",
            AuthorUrl = "https://site.com/author1"
        },
        new ReviewInfo()
        {
            BestRating = 5.0,
            WorstRating = 1.0,
            RatingValue = 5.0,
            Description = "Review Description 2",
            AuthorName = "Review Author 2",
            AuthorUrl = "https://site.com/author2"
        }
    },
    Offers = new[]
    {
        new OfferInfo()
        {
            Price = 1500,
            PriceCurrency = "USD",
            Url = "https://site.com/product-url/",
            PriceValidUntil = DateTime.Now.AddDays(10)
        },
        new OfferInfo()
        {
            Price = 1499,
            PriceCurrency = "USD",
            Url = "https://site.com/product-url/",
            PriceValidUntil = DateTime.Now.AddDays(15)
        }
    }
};

Html.SetSeoInfo(seoInfo =>
{
    seoInfo.JsonLd.AddProduct(product);
});

Rendred Output

The following code shows the rendered output.

<script type="application/ld+json">
{
    "@context": "https://schema.org",
    "@graph": [
        {
            "@type": "Product",
            "@id": "https://site.com/product-url/#product",
            "name": "Product Name",
            "description": "Product Description",
            "alternateName": "Product AlternateName",
            "image": [
                {
                    "@type": "ImageObject",
                    "@id": "https://site.com/uploads/image-1.jpg#image",
                    "url": "https://site.com/uploads/image-1.jpg",
                    "inLanguage": "en-US",
                    "contentUrl": "https://site.com/uploads/image-1.jpg",
                    "height": "720",
                    "width": "1280",
                    "caption": "Image Name"
                },
                {
                    "@type": "ImageObject",
                    "@id": "https://site.com/uploads/image-2.jpg#image",
                    "url": "https://site.com/uploads/image-2.jpg",
                    "inLanguage": "en-US",
                    "contentUrl": "https://site.com/uploads/image-2.jpg",
                    "height": "720",
                    "width": "1280",
                    "caption": "Image Name 2"
                }
            ],
            "url": "https://site.com/product-url/",
            "aggregateRating": {
                "@type": "AggregateRating",
                "bestRating": 5.0,
                "ratingValue": 4.5,
                "worstRating": 1.0,
                "ratingCount": 123,
                "reviewCount": 123
            },
            "brand": {
                "@type": "Brand",
                "name": "Brand Name"
            },
            "category": "Product Category",
            "mpn": "12345",
            "offers": {
                "@type": "AggregateOffer",
                "priceCurrency": "USD",
                "highPrice": 1500.0,
                "lowPrice": 1499.0,
                "offerCount": 2,
                "offers": [
                    {
                        "@type": "Offer",
                        "url": "https://site.com/product-url/",
                        "price": 1500.0,
                        "priceCurrency": "USD",
                        "priceValidUntil": "2021-08-03"
                    },
                    {
                        "@type": "Offer",
                        "url": "https://site.com/product-url/",
                        "price": 1499.0,
                        "priceCurrency": "USD",
                        "priceValidUntil": "2021-08-08"
                    }
                ]
            },
            "review": [
                {
                    "@type": "Review",
                    "description": "Review Description 1",
                    "author": {
                        "@type": "Person",
                        "name": "Review Author 1",
                        "url": "https://site.com/author1"
                    },
                    "reviewBody": "Review Description 1",
                    "reviewRating": {
                        "@type": "Rating",
                        "bestRating": 5.0,
                        "ratingValue": 4.5,
                        "worstRating": 1.0
                    }
                },
                {
                    "@type": "Review",
                    "description": "Review Description 2",
                    "author": {
                        "@type": "Person",
                        "name": "Review Author 2",
                        "url": "https://site.com/author2"
                    },
                    "reviewBody": "Review Description 2",
                    "reviewRating": {
                        "@type": "Rating",
                        "bestRating": 5.0,
                        "ratingValue": 5.0,
                        "worstRating": 1.0
                    }
                }
            ],
            "sku": "12345"
        }
    ]
}
</script>

Note

Be sure to test your structured data using the google Rich Results Test tool during development, and the Rich result status reports after deployment, to monitor the health of your pages.