DaffSchemaService
A service for managing JSON-LD schema tags in a document.
There is only ever one schema tag per document, multiple
schemas can be added by calling upsert
with an array.
The schema data can be found via a script
tag with
the id
daff-schema
in the document.
import { DaffSchemaService } from '@daffodil/seo'
@Injectable()
class DaffSchemaService<<T>> {
readonly selector: 'daff-schema'
get scriptTag(): HTMLScriptElement | null
getSchema(): string
upsert(schema: Schema<T>): void
remove(): void
}
Properties
Name | Type | Description |
---|---|---|
selector | 'daff-schema' | |
scriptTag | HTMLScriptElement | null | Memoized schema script tag. |
getSchema | string | The string represenation of the schema. WARNING: This content is comes directly from the DOM. It could contain malicious content, be very careful with what you do with it. |
upsert | void | Either creates a new schema tag in the document, or updates the existing schema tag in the document. |
remove | void | Removes the schema from the document. |