Skip to main content

Module profiles

Module profiles 

Source
Expand description

Rich Results profile system – platform-specific validation beyond Schema.org.

After M2’s vocabulary validation answers “is this valid Schema.org?”, the profile system answers “will Google actually show a rich result for this?”.

§Architecture

StructuredDataGraph
    +---- ProfileRegistry
        +---- Google Product profile
        +---- Google Article profile
        +---- Google `FAQPage` profile
        +---- Google `BreadcrumbList` profile
        +---- Google `LocalBusiness` profile
        +---- Google Event profile
        +---- Google Recipe profile
        +---- Baseline profile

§Examples

use schemaorg_rs::{extract_all, validation};
use schemaorg_rs::profiles::{ProfileRegistry, Eligibility};

let html = r#"<script type="application/ld+json">{
  "@context": "https://schema.org",
  "@type": "Product",
  "name": "Widget"
}</script>"#;

let graph = extract_all(html).unwrap();
let vocab_result = validation::validate(&graph);
let registry = ProfileRegistry::with_google();
let result = registry.evaluate("google", &graph, &vocab_result.diagnostics).unwrap();

match result.eligibility {
    Eligibility::Eligible => println!("Rich result eligible!"),
    Eligibility::WarningsOnly => println!("Eligible with warnings"),
    Eligibility::NotEligible => println!("Not eligible"),
    Eligibility::Restricted => println!("Restricted eligibility"),
}

Modules§

baseline
Baseline Schema.org profile – generic best-practices validation.
engine
Profile evaluation engine – orchestrates profile checks across graph nodes.
google
Google Rich Results profiles.

Structs§

NodeProfileResult
Result of evaluating a single node against a profile.
ProfileRegistry
A registry of available profiles for evaluation.
ProfileResult
Overall result of evaluating a graph against a profile.
TypeEligibility
Per-type eligibility breakdown.

Enums§

Eligibility
Eligibility verdict for rich result display.
ProfileError
Errors that can occur during profile evaluation.

Traits§

Profile
A deployment profile adds platform-specific rules beyond Schema.org vocabulary validation.