@wix/site-service-head-appender
v1.0.1
Published
Provides a service for appending safe content to the document head.
Maintainers
Keywords
Readme
@wix/site-service-head-appender
Provides a service for appending safe content to the document head.
Install
yarn add @wix/site-service-head-appenderUsage
import { HeadAppenderDefinition } from '@wix/site-service-head-appender/definition'
import { HeadContentType } from '@wix/site-service-head-appender/types'
const headAppender = servicesManager.getService(HeadAppenderDefinition)
headAppender.setHead(
'<meta name="description" content="Site description" />',
HeadContentType.AFTER_SECURITY
)API
setHead(content, type)
Appends head content through the host-provided head handling flow.
| Parameter | Type | Default | Description |
|---|---|---|---|
| content | string | - | The HTML content to add to the document head. |
| type | HeadContentType | HeadContentType.AFTER_SECURITY | The head content bucket used by the host. |
content must not contain script tags. The service rejects direct, encoded, and obfuscated <script> variants before passing content to the host.
