import { DaffSchemaService } from '@daffodil/seo'
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.
@Injectable()
class DaffSchemaService<<T>> {
readonly selector: "daff-schema" = 'daff-schema'
get scriptTag(): HTMLScriptElement
getSchema(): string
upsert(schema: Schema<T>): void
remove(): void
}
"daff-schema"
Default | 'daff-schema' |
---|---|
Description |
HTMLScriptElement
Default | – |
---|---|
Description | Memoized schema script tag. |
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.
void
Either creates a new schema tag in the document, or updates the existing schema tag in the document.
Parameter | schema: Schema |
---|---|
Description |
void
Removes the schema from the document.