$google_schema

The $google_schema variable returns the schema type set for the Google mirror instance, typically for structured data. — NGINX Module for Google Mirror creation

$google_schema NGINX Module for Google Mirror creation

Description

The $google_schema variable is used within the NGINX Module for Google Mirror creation to dynamically provide the schema type associated with the current request context. It is populated when the google filter is enabled via a specific `location` directive, allowing it to reflect and utilize settings configured in that directive to present structured data, primarily for Google’s indexing and data scraping systems. This variable evaluates and retrieves the schema type during the processing of requests. The appropriate schema type can be defined in the NGINX configuration and is often tied to the specific content being served. Common values for this variable might include 'WebSite', 'Article', or other relevant schema types recognized by schema.org, which help inform search engines about the data being presented, thus enhancing the SEO and visibility of the site. Depending on configuration, this variable allows for flexibility in changing schema types based on the content type needed for the current request environment. When defining this for usage, careful consideration should be taken into account for the JSON-LD scripts that may utilize these schema types, ensuring that the correct schema matches the content being served to maximize search engine patience and recognition of the site’s content. Since this variable is affected by other NGINX configurations, it often requires a coordinated setup to ensure accurate values are returned for the appropriate requests.

Config Example

location / {
    google on;
    google_schema "WebSite";
}

Subsystem

http

Cacheable

No

Contexts

http, server, location

Ensure that the google module is enabled in the server context for this variable to work properly.

Misconfiguring or omitting the schema type can result in unexpected behaviors or empty responses for the variable.

If using multiple locations, be sure that each location handles the schema variables as intended to avoid conflicts.