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 the
keywords`. - specialized meta information added to the page via
<meta>
elements with theproperty
attribute, for example the OG meta tags (og:type
,og:image
, etc.).
- the generic named meta information added to the page via
Hierarchy
MetaManager
Constructors
constructor
• new MetaManager()
Methods
clearMetaAttributes
▸ clearMetaAttributes(): void
Resets the stored meta names, properties and links.
Returns
void
Defined in
packages/core/src/meta/MetaManager.ts:195
getLink
▸ getLink(relation
): MetaManagerRecord
<"href"
>
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
Name | Type | Description |
---|---|---|
relation | string | The relation of the link target to the current page. |
Returns
MetaManagerRecord
<"href"
>
The reference to the location of the related document, e.g. a URL.
Defined in
packages/core/src/meta/MetaManager.ts:169
getLinks
▸ 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:177
getLinksIterator
▸ getLinksIterator(): never
[] | IterableIterator
<[string
, MetaManagerRecord
<"href"
>]>
Return [key, value] pairs of currently set links.
Returns
never
[] | IterableIterator
<[string
, MetaManagerRecord
<"href"
>]>
[key, value] pairs of currently set links.
Defined in
packages/core/src/meta/MetaManager.ts:186
getMetaName
▸ getMetaName(name
): MetaManagerRecord
<"content"
>
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
Name | Type | Description |
---|---|---|
name | string | The name of the named meta information property. |
Returns
MetaManagerRecord
<"content"
>
The value of the generic meta information, or an empty string.
Defined in
packages/core/src/meta/MetaManager.ts:69
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:80
getMetaNamesIterator
▸ getMetaNamesIterator(): never
[] | IterableIterator
<[string
, MetaManagerRecord
<"content"
>]>
Return [key, value] pairs of named meta information.
Returns
never
[] | IterableIterator
<[string
, MetaManagerRecord
<"content"
>]>
[key, value] pairs of named meta information.
Defined in
packages/core/src/meta/MetaManager.ts:89
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:131
getMetaPropertiesIterator
▸ getMetaPropertiesIterator(): never
[] | IterableIterator
<[string
, MetaManagerRecord
<"content"
>]>
Return [key, value] pairs of meta information properties.
Returns
never
[] | IterableIterator
<[string
, MetaManagerRecord
<"content"
>]>
[key, value] pairs of meta information properties.
Defined in
packages/core/src/meta/MetaManager.ts:140
getMetaProperty
▸ getMetaProperty(property
): MetaManagerRecord
<"content"
>
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
Name | Type |
---|---|
property | string |
Returns
MetaManagerRecord
<"content"
>
The value of the specified meta information, or an empty string.
Defined in
packages/core/src/meta/MetaManager.ts:120
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:45
setLink
▸ setLink(relation
, href
, attr?
): MetaManager
Sets the specified specialized link information.
Parameters
Name | Type | Description |
---|---|---|
relation | string | The relation of the link target to the current page. |
href | MetaValue | The reference to the location of the related document, e.g. a URL. |
attr? | MetaAttributes | - |
Returns
Parram
attr Additional optional link attributes.
Defined in
packages/core/src/meta/MetaManager.ts:155
setMetaName
▸ setMetaName(name
, content
, attr?
): MetaManager
Set the specified named meta information property.
Parameters
Name | Type | Description |
---|---|---|
name | string | Meta information property name, for example keywords . |
content | MetaValue | The meta information content. |
attr? | MetaAttributes | - |
Returns
Parram
attr Additional optional meta attributes.
Defined in
packages/core/src/meta/MetaManager.ts:57
setMetaProperty
▸ setMetaProperty(property
, content
, attr?
): MetaManager
Sets the specified specialized meta information property.
Parameters
Name | Type | Description |
---|---|---|
property | string | The value of the meta information property. |
content | MetaValue | - |
attr? | MetaAttributes | - |
Returns
Parram
attr Additional optional meta attributes.
Defined in
packages/core/src/meta/MetaManager.ts:102
setTitle
▸ setTitle(title
): MetaManager
Sets the page title.
Parameters
Name | Type | Description |
---|---|---|
title | string | The new page title. |