Ngx meta.makecomposedkeyvalmetadefinition
Home > @davidlj95/ngx-meta > makeComposedKeyValMetaDefinition
makeComposedKeyValMetaDefinition() function
Creates a key / value meta definition (see makeKeyValMetaDefinition()) where the key is composed by several parts.
Signature:
makeComposedKeyValMetaDefinition: (names: ReadonlyArray<string>, options?: {
keyAttr?: string;
valAttr?: string;
separator?: string;
}) => NgxMetaMetaDefinition
Parameters
Parameter | Type | Description |
---|---|---|
names | ReadonlyArray<string> | Names to create they key name |
options | { keyAttr?: string; valAttr?: string; separator?: string; } | (Optional) Options to create the key/val meta definition. See makeKeyValMetaDefinition() options. Accepts a separator argument, which defines how key names will be joined together. Separator defaults to : |
Returns:
Example
For instance, Open Graph's meta definition for property og:title
(hence element <meta property='og:title'>
) could be created with:
const ogTitleMetaDefinition = makeComposedKeyValMetaDefinition(
['og', 'title'],
{
keyAttr: 'property',
separator: ':', // could be omitted, as it's the default one
}
)