Skip to content

Ngx meta.makecomposedkeyvalmetadefinition

Home > @davidlj95/ngx-meta > makeComposedKeyValMetaDefinition

makeComposedKeyValMetaDefinition() function

Warning: This API is now obsolete.

Use NgxMetaElementsService APIs instead. See custom metadata guide for more info

Creates a key / value meta definition (NgxMetaMetaDefinition) where the key name is composed by several strings joined by a separator.

See also makeKeyValMetaDefinition()

Signature:

makeComposedKeyValMetaDefinition: (names: ReadonlyArray<string>, options?: MakeComposedKeyValMetaDefinitionOptions) => NgxMetaMetaDefinition

Parameters

Parameter Type Description
names ReadonlyArray<string> Names to create they key name
options MakeComposedKeyValMetaDefinitionOptions (Optional) Options object

Returns:

NgxMetaMetaDefinition

Example

For instance, Open Graph's meta definition for property og:title (hence element <meta property='og:title'>) is composed of og and title. Its NgxMetaMetaDefinition could be created with:

const ogTitleMetaDefinition = makeComposedKeyValMetaDefinition(
  ['og', 'title'],
  {
    keyAttr: 'property',
    separator: ':', // Could be omitted, as it's the default one
  }
)