Class SchemaArticle

java.lang.Object
com.oorian.schema.SchemaType
com.oorian.schema.SchemaArticle
All Implemented Interfaces:
Jsonable

public class SchemaArticle extends SchemaType
Represents a Schema.org Article.

An Article represents a written work intended for a wide audience, such as a news article, blog post, or scholarly article. This schema type helps search engines display rich snippets with article information.

Usage:


 SchemaArticle article = new SchemaArticle()
     .setHeadline("Getting Started with Oorian")
     .setDescription("Learn how to build your first Oorian application")
     .setDatePublished("2025-01-10")
     .setDateModified("2025-01-15")
     .setAuthorName("Marvin Warble")
     .setImage("https://oorian.com/blog/getting-started.jpg");

 head.addElement(new JsonLdScript(article));
 
Since:
2025
Version:
1.0
Author:
Claude
  • Constructor Details

    • SchemaArticle

      public SchemaArticle()
  • Method Details

    • setHeadline

      public SchemaArticle setHeadline(String headline)
      Sets the headline/title of the article.
      Parameters:
      headline - The article headline
      Returns:
      This article for method chaining
    • setDescription

      public SchemaArticle setDescription(String description)
      Sets a description/summary of the article.
      Parameters:
      description - The article description
      Returns:
      This article for method chaining
    • setDatePublished

      public SchemaArticle setDatePublished(String datePublished)
      Sets the date the article was first published (ISO 8601 format).
      Parameters:
      datePublished - The publication date (e.g., "2025-01-10")
      Returns:
      This article for method chaining
    • setDateModified

      public SchemaArticle setDateModified(String dateModified)
      Sets the date the article was last modified (ISO 8601 format).
      Parameters:
      dateModified - The modification date (e.g., "2025-01-15")
      Returns:
      This article for method chaining
    • setAuthorName

      public SchemaArticle setAuthorName(String authorName)
      Sets the name of the article author.
      Parameters:
      authorName - The author's name
      Returns:
      This article for method chaining
    • setAuthorUrl

      public SchemaArticle setAuthorUrl(String authorUrl)
      Sets the URL of the article author's profile.
      Parameters:
      authorUrl - The author's profile URL
      Returns:
      This article for method chaining
    • setPublisher

      public SchemaArticle setPublisher(SchemaOrganization publisher)
      Sets the publisher of the article.
      Parameters:
      publisher - The publishing organization
      Returns:
      This article for method chaining
    • setMainEntityOfPage

      public SchemaArticle setMainEntityOfPage(String mainEntityOfPage)
      Sets the URL of the page that is the main subject of this article.
      Parameters:
      mainEntityOfPage - The main entity URL (typically the article's URL)
      Returns:
      This article for method chaining
    • setWordCount

      public SchemaArticle setWordCount(String wordCount)
      Sets the word count of the article.
      Parameters:
      wordCount - The number of words
      Returns:
      This article for method chaining
    • addImage

      public SchemaArticle addImage(String imageUrl)
      Adds an image URL for the article.
      Parameters:
      imageUrl - The image URL
      Returns:
      This article for method chaining
    • setImage

      public SchemaArticle setImage(String imageUrl)
      Sets a single image for the article (convenience method).
      Parameters:
      imageUrl - The image URL
      Returns:
      This article for method chaining
    • toJsonValue

      public JsonValue toJsonValue()
      Description copied from interface: Jsonable
      Serializes this object to a JsonValue.
      Specified by:
      toJsonValue in interface Jsonable
      Specified by:
      toJsonValue in class SchemaType
      Returns:
      the JSON representation of this object.