SigNoz / signoz-web

SigNoz Website
https://signoz.io
Other
6 stars 36 forks source link

Structured Data Fix #480

Closed yuvraajsj18 closed 3 months ago

yuvraajsj18 commented 3 months ago

Problem:

  1. Modify the automated schema inserted into each blog to follow the right structure template.
  2. Allow a way to ingest schema to a certain blog manually.

Automated Schema Ingestion

Image

For all articles (no matter their type), we need the following automated schema:

{
  "@context": "https://schema.org",
  "@type": "BlogPosting",
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://signoz.io/guides/golang-logrus/"
  },
  "headline": "Golang Logrus - Complete Guide to logging in Golang with Logrus",
  "description": "In this tutorial, we will discover Golang logrus and some of the best practices provided by logrus for implementing structured logging in Golang applications. We will set up the Golang application and practice different logging formats logrus provides.",
  "image": [],
  "author": {
    "@type": "Person",
    "name": "Aayush Sharma"
  },
  "publisher": {
    "@type": "Organization",
    "name": "SigNoz",
    "logo": {
      "@type": "ImageObject",
      "url": "https://signoz.io/img/SigNozLogo-orange.svg"
    }
  },
  "datePublished": "2024-07-11T00:00:00.000Z",
  "dateModified": "2024-07-11T00:00:00.000Z"
}

For all docs, we need following:

{
  "@context": "https://schema.org",
  "@type": "TechArticle",
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://signoz.io/docs/introduction/"
  },
  "headline": "Introduction",
  "description": "Doc Description",
  "image": [""],
  "author": {
    "@type": "Person",
    "name": "Aayush Sharma"
  },
  "publisher": {
    "@type": "Organization",
    "name": "SigNoz",
    "logo": {
      "@type": "ImageObject",
      "url": "https://signoz.io/img/SigNozLogo-orange.svg"
    }
  },
  "datePublished": "2024-07-11T00:00:00.000Z",
  "dateModified": "2024-07-11T00:00:00.000Z",
  }
}

Allow Manual Ingestion of Detailed Schema

Currently, I add manual schema by putting the JSON LD in template literals inside head tag but it is parsed incorrectly (" is parsed as ")

Image

Sample Schema Ingested:

<head>
  <script type="application/ld+json">
    {`{
  "@context": "https://schema.org",
  "@type": "TechArticle",
  "headline": "Pino Logger - Complete Guide to Logging in NodeJS with Pino",
  "alternativeHeadline": "Master NodeJS logging with Pino - Learn setup, configuration, and advanced features for efficient, structured logging",
  "author": {
    "@type": "Person",
    "name": "Anubhav Omar"
  },
  "publisher": {
    "@type": "Organization",
    "name": "SigNoz",
    "logo": {
      "@type": "ImageObject",
      "url": "https://signoz.io/img/SigNozLogo-orange.svg"
    }
  },
  "datePublished": "2024-07-10",
  "dateModified": "2024-07-10",
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://signoz.io/guides/pino-logger/"
  },
  "description": "Master NodeJS logging with Pino - Learn setup, configuration, and advanced features for efficient, structured logging. Boost debugging and monitoring in your applications.",
  "keywords": "pino logger, nodejs logging, structured logging, pino-pretty, pino-http, child loggers, asynchronous logging, log levels, nodejs debugging, application monitoring",
  "articleSection": "Technology",
  "inLanguage": "en",
  "isPartOf": {
    "@type": "Blog",
    "name": "SigNoz Blog",
    "url": "https://signoz.io/blog/"
  },
  "about": [
    {
      "@type": "Thing",
      "name": "Pino Logger",
      "description": "A fast and low overhead logging library for NodeJS"
    },
    {
      "@type": "Thing",
      "name": "NodeJS",
      "description": "A JavaScript runtime built on Chrome's V8 JavaScript engine"
    },
    {
      "@type": "Thing",
      "name": "Structured Logging",
      "description": "A logging approach that treats log entries as data structures rather than plain text"
    }
  ],
  "mentions": [
    {
      "@type": "SoftwareApplication",
      "name": "Pino",
      "applicationCategory": "Logging Library"
    },
    {
      "@type": "SoftwareApplication",
      "name": "SigNoz",
      "applicationCategory": "Observability Platform"
    }
  ],
  "mainEntity": {
    "@type": "FAQPage",
    "mainEntity": [
      {
        "@type": "Question",
        "name": "What is Pino package?",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "The Pino package is a Node.js logging library designed for speed and efficiency, offering robust features and flexible configuration options for developers."
        }
      },
      {
        "@type": "Question",
        "name": "What is the common log format in Pino?",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "Pino uses a default JSON-based log format, which is structured and easy to parse for automated processing and analysis."
        }
      },
      {
        "@type": "Question",
        "name": "What is Pino pretty?",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "Pino pretty (pino-pretty) is a tool that formats Pino's JSON logs into a more human-readable format, enhancing readability during development and debugging."
        }
      },
      {
        "@type": "Question",
        "name": "What are the benefits of Pino logger?",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "Pino provides benefits such as high performance, low CPU overhead, simple integration, and support for custom serializers and log levels, making it ideal for production environments."
        }
      },
      {
        "@type": "Question",
        "name": "Can Pino handle asynchronous logging?",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "Yes, Pino supports asynchronous logging, which helps maintain high performance and low overhead by not blocking the main event loop during log operations."
        }
      }
    ]
  },
  "tutorial": {
    "@type": "HowTo",
    "name": "How to Use Pino Logger in NodeJS",
    "step": [
      {
        "@type": "HowToStep",
        "name": "Install Pino",
        "text": "Install Pino using npm: npm install pino"
      },
      {
        "@type": "HowToStep",
        "name": "Import and Configure Pino",
        "text": "Import Pino in your NodeJS application and create a logger instance"
      },
      {
        "@type": "HowToStep",
        "name": "Set Log Levels",
        "text": "Configure log levels to control the verbosity of logs"
      },
      {
        "@type": "HowToStep",
        "name": "Use Custom Serializers",
        "text": "Implement custom serializers to format log data"
      },
      {
        "@type": "HowToStep",
        "name": "Implement Child Loggers",
        "text": "Use child loggers for modular logging in different parts of your application"
      },
      {
        "@type": "HowToStep",
        "name": "Set Up Asynchronous Logging",
        "text": "Configure asynchronous logging for improved performance"
      },
      {
        "@type": "HowToStep",
        "name": "Integrate with SigNoz",
        "text": "Set up SigNoz and configure Pino to send logs to SigNoz for centralized monitoring"
      }
    ]
  }
}`}
  </script>
</head>

How to ingest this without an error?


Case study on impact of fixing structure data issues - https://developers.google.com/search/case-studies/saramin-case-study?hl=en

YounixM commented 3 months ago

Merged ✅