Skip to main content

Class: MetaManager

@ima/core.MetaManager

The Meta manager is a utility for managing various page attributes related to the SEO (search engine optimization) and social network integration.

The Meta manager is used to manage the following:

  • page title, set using the contents of the <title> element
  • page links, linking related documents and meta-information, added to the using <link> elements
  • page meta information:
    • the generic named meta information added to the page via <meta>} elements with the nameattribute, for example thekeywords`.
    • specialized meta information added to the page via <meta> elements with the property attribute, for example the OG meta tags (og:type, og:image, etc.).

Hierarchy

Constructors

constructor

new MetaManager()

Methods

getLink(relation): string

Return the reference to the specified related linked document. The method returns an empty string for missing meta information (to make the returned value React-friendly).

Parameters

NameTypeDescription
relationstringThe relation of the link target to the current page.

Returns

string

The reference to the location of the related document, e.g. a URL.

Defined in

packages/core/src/meta/MetaManager.ts:134


getLinks(): string[]

Returns the relations of the currently set related documents linked to the current page.

Returns

string[]

Defined in

packages/core/src/meta/MetaManager.ts:142


getMetaName

getMetaName(name): string

Returns the value of the specified named meta information property. The method returns an empty string for missing meta information (to make the returned value React-friendly).

Parameters

NameTypeDescription
namestringThe name of the named meta information property.

Returns

string

The value of the generic meta information, or an empty string.

Defined in

packages/core/src/meta/MetaManager.ts:62


getMetaNames

getMetaNames(): string[]

Returns the names of the currently specified named meta information properties.

Returns

string[]

The names of the currently specified named meta information properties.

Defined in

packages/core/src/meta/MetaManager.ts:73


getMetaProperties

getMetaProperties(): string[]

Returns the names of the currently specified specialized meta information properties.

Returns

string[]

The names of the currently specified specialized meta information properties.

Defined in

packages/core/src/meta/MetaManager.ts:108


getMetaProperty

getMetaProperty(name): string

Returns the value of the specified specialized meta information property. The method returns an empty string for missing meta information (to make the returned value React-friendly).

Parameters

NameTypeDescription
namestringThe name of the specialized meta information property.

Returns

string

The value of the specified meta information, or an empty string.

Defined in

packages/core/src/meta/MetaManager.ts:97


getTitle

getTitle(): string

Returns the page title. The method returns an empty string if no page title has been set yet.

Note that the page title is cached internally by the meta manager and may therefore differ from the current document title if it has been modified by a 3rd party code.

Returns

string

The current page title.

Defined in

packages/core/src/meta/MetaManager.ts:39


setLink(relation, reference): void

Sets the specified specialized link information.

Parameters

NameTypeDescription
relationstringThe relation of the link target to the current page.
referencestringThe reference to the location of the related document, e.g. a URL.

Returns

void

Defined in

packages/core/src/meta/MetaManager.ts:120


setMetaName

setMetaName(name, value): void

Set the specified named meta information property.

Parameters

NameTypeDescription
namestringMeta information property name, for example keywords.
valuestringThe meta information value.

Returns

void

Defined in

packages/core/src/meta/MetaManager.ts:50


setMetaProperty

setMetaProperty(name, value): void

Sets the specified specialized meta information property.

Parameters

NameTypeDescription
namestringName of the specialized meta information property.
valuestringThe value of the meta information property.

Returns

void

Defined in

packages/core/src/meta/MetaManager.ts:83


setTitle

setTitle(title): void

Sets the page title.

Parameters

NameTypeDescription
titlestringThe new page title.

Returns

void

Defined in

packages/core/src/meta/MetaManager.ts:25