seoschema.orggoogle-rich-snippets

Blog posting snippet is not detected by validator


I create a schema BlogPosting for my blog posts and this is the output that I copied from source:

<script type="application/ld+json">
{
  "@type": "BlogPosting",
  "headline": "title",
  "datePublished": "2024-07-30T09:05:20+03:30",
  "dateModified": "2025-01-01T09:13:18+03:30",
  "articleSection": "cat1, cat2",
  "author": {
    "@id": "https://example.com/mag/author/abc/",
    "name": "abc"
  },
  "publisher": {
    "@id": "https://example.com/#organization",
    "name": "site"
  },
  "description": "description",
  "name": "title",
  "mainEntityOfPage": {
    "@id": "https://example.com/mag/train-refund-guide/"
  },
  "isPartOf": {
    "@id": "https://example.com/#website"
  },
  "primaryImageOfPage": {
    "@id": "https://example.com/wp-content/uploads/2024/07/train-cancel-1-e1734600689487.webp"
  },
  "inLanguage": "fa-IR",
  "subjectOf": {
    "@type": "FAQPage",
    "mainEntity": [
      {
        "@type": "Question",
        "url": "https://example.com/mag/train-refund-guide/#faq-question-%d8%a8%d8%b9%d8%af-%d8%a7%d8%b2-%d8%ae%d8%b1%db%8c%d8%af-%d8%a8%d9%84%db%8c%d8%b7-%d9%82%d9%82%d8%a7%d8%b1-%d9%85%db%8c%d8%aa%d9%88%d8%a7%d9%86%d9%85-%d8%a2%d9%86-%d8%B1%d8%a7-%da%a9",
        "name": "question1",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "answer1"
        }
      },
      {
        "@type": "Question",
        "url": "https://example.com/mag/train-refund-guide/#faq-question-%d8%a2%db%8c%d8%a7-%d9%85%db%8c%d8%aa%d9%88%d8%a7%d9%86%d9%85-%d8%a8%d9%84%db%8c%d8%b7-%d8%ae%d9%88%d8%af-%d8%b1%d8%a7-%d8%af%d8%b1-%d9%87%d8%b1-%d8%b2%d9%85%d8%a7%d9%86%db%8c-%d8%a7%d8%b3",
        "name": "question2",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "answer2"
        }
      },
      {
        "@type": "Question",
        "url": "https://example.com/mag/train-refund-guide/#faq-question-%d8%a2%db%8c%d8%a7-%d8%a8%d8%b1%d8%a7%db%8c-%d8%a7%d8%b3%d8%aa%d8%b1%d8%af%d8%a7%d8%af-%d8%a8%d9%84%db%8c%d8%b7-%d8%a8%d8%a7%db%8c%d8%af-%d9%87%d8%b2%db%8c%d9%86%d9%87%d9%87%d8%a7%db%8c-%d9%be",
        "name": "question3",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "answer3"
        }
      },
      {
        "@type": "Question",
        "url": "https://example.com/mag/train-refund-guide/#faq-question-%d8%aa%d8%a7-%da%86%d9%87-%d8%b2%d9%85%d8%a7%d9%86%db%8c-%d8%af%d8%b1-%d8%b5%d9%88%d8%b1%d8%aa-%da%a9%d9%86%d8%b3%d9%84%db%8c%d8%8c-%d9%85%d8%a8%d9%84%d8%ba-%da%a9%d9%84-%d8%a8%d9%84%db%8c%d8%b7",
        "name": "question4",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "answer4"
        }
      }
    ]
  }
}
</script>

in the google validator I enter my url and in type of schema it shows "https://example.com/mag/train-refund-guide/BlogPosting" and in reach results it does not even identify as a valid schema. what is wrong on my output?


Solution

  • The code is missing @context property with reference to schema.org, which is why it cannot map terms and doesn't detect the snippet.

    So, add context keyword as required:

    "@context": "https://schema.org",
    

    full code:

    <script type="application/ld+json">
        {
          "@context": "https://schema.org",
          "@type": "BlogPosting",
          "headline": "title",
          "datePublished": "2024-07-30T09:05:20+03:30",
          "dateModified": "2025-01-01T09:13:18+03:30",
          "articleSection": "cat1, cat2",
          "author": {
            "@id": "https://example.com/mag/author/abc/",
            "name": "abc"
          },
          "publisher": {
            "@id": "https://example.com/#organization",
            "name": "site"
          },
          "description": "description",
          "name": "title",
          "mainEntityOfPage": {
            "@id": "https://example.com/mag/train-refund-guide/"
          },
          "isPartOf": {
            "@id": "https://example.com/#website"
          },
          "primaryImageOfPage": {
            "@id": "https://example.com/wp-content/uploads/2024/07/train-cancel-1-e1734600689487.webp"
          },
          "inLanguage": "fa-IR",
          "subjectOf": {
            "@type": "FAQPage",
            "mainEntity": [
              {
                "@type": "Question",
                "url": "https://example.com/mag/train-refund-guide/#faq-question-%d8%a8%d8%b9%d8%af-%d8%a7%d8%b2-%d8%ae%d8%b1%db%8c%d8%af-%d8%a8%d9%84%db%8c%d8%b7-%d9%82%d9%82%d8%a7%d8%b1-%d9%85%db%8c%d8%aa%d9%88%d8%a7%d9%86%d9%85-%d8%a2%d9%86-%d8%B1%d8%a7-%da%a9",
                "name": "question1",
                "acceptedAnswer": {
                  "@type": "Answer",
                  "text": "answer1"
                }
              },
              {
                "@type": "Question",
                "url": "https://example.com/mag/train-refund-guide/#faq-question-%d8%a2%db%8c%d8%a7-%d9%85%db%8c%d8%aa%d9%88%d8%a7%d9%86%d9%85-%d8%a8%d9%84%db%8c%d8%b7-%d8%ae%d9%88%d8%af-%d8%b1%d8%a7-%d8%af%d8%b1-%d9%87%d8%b1-%d8%b2%d9%85%d8%a7%d9%86%db%8c-%d8%a7%d8%b3",
                "name": "question2",
                "acceptedAnswer": {
                  "@type": "Answer",
                  "text": "answer2"
                }
              },
              {
                "@type": "Question",
                "url": "https://example.com/mag/train-refund-guide/#faq-question-%d8%a2%db%8c%d8%a7-%d8%a8%d8%b1%d8%a7%db%8c-%d8%a7%d8%b3%d8%aa%d8%b1%d8%af%d8%a7%d8%af-%d8%a8%d9%84%db%8c%d8%b7-%d8%a8%d8%a7%db%8c%d8%af-%d9%87%d8%b2%db%8c%d9%86%d9%87%d9%87%d8%a7%db%8c-%d9%be",
                "name": "question3",
                "acceptedAnswer": {
                  "@type": "Answer",
                  "text": "answer3"
                }
              },
              {
                "@type": "Question",
                "url": "https://example.com/mag/train-refund-guide/#faq-question-%d8%aa%d8%a7-%da%86%d9%87-%d8%b2%d9%85%d8%a7%d9%86%db%8c-%d8%af%d8%b1-%d8%b5%d9%88%d8%b1%d8%aa-%da%a9%d9%86%d8%b3%d9%84%db%8c%d8%8c-%d9%85%d8%a8%d9%84%d8%ba-%da%a9%d9%84-%d8%a8%d9%84%db%8c%d8%b7",
                "name": "question4",
                "acceptedAnswer": {
                  "@type": "Answer",
                  "text": "answer4"
                }
              }
            ]
          }
        }
        </script>