Skip to content

API Reference

Home > @davidlj95/ngx-meta

ngx-meta package

Classes

Class Description
NgxMetaCoreModule

Adds core providers of ngx-meta to the application. Must use NgxMetaCoreModule.forRoot() method.

For standalone apps, use provideNgxMetaCore() instead

NgxMetaJsonLdModule

Adds JSON-LD module metadata managers

For standalone apps, use provideNgxMetaJsonLd() instead

NgxMetaMetadataLoaderModule

Allows to load metadata modules after library has been initialized

For standalone apps, use provideNgxMetaMetadataLoader() instead

NgxMetaMetaService Upserts (or removes) <meta> elements in the current page using Angular's Meta under the hood.
NgxMetaOpenGraphModule

Adds Open Graph module basic & optional metadata managers

For standalone apps, use provideNgxMetaOpenGraph() instead

NgxMetaOpenGraphProfileModule

Adds Open Graph module profile metadata managers

For standalone apps, use provideNgxMetaOpenGraphProfile() instead

NgxMetaRoutingModule

Allows to manage metadata of a page by specifying it in its Angular's Route.data

For standalone apps, use provideNgxMetaRouting() instead

NgxMetaService Manages the metadata values of the current page
NgxMetaStandardModule

Adds standard module metadata managers

For standalone apps, use provideNgxMetaStandard() instead

NgxMetaTwitterCardModule

Adds Twitter Cards module metadata managers

For standalone apps, use provideNgxMetaTwitterCard() instead

Abstract Classes

Abstract Class Description
NgxMetaMetadataManager

Abstract class every metadata manager must implement.

Used as injection token to provide metadata managers the library will take into account.

Can be created with makeMetadataManagerProviderFromSetterFactory()

Functions

Function Description
makeComposedKeyValMetaDefinition(names, options) Creates a key / value meta definition (see makeKeyValMetaDefinition()) where the key is composed by several parts.
makeKeyValMetaDefinition(keyName, options) Creates a NgxMetaMetaDefinition for its use with NgxMetaMetaService by understanding <meta> elements as key / value pair elements. Read the API reference docs for more info.
makeMetadataManagerProviderFromSetterFactory(setterFactory, opts) Creates an Angular's Factory provider that provides an NgxMetaMetadataManager
provideNgxMetaCore(features)

Adds core services of the library to the application.

For module-based apps, use NgxMetaCoreModule.forRoot() instead

Allows specifying some default metadata values. Keep reading.

provideNgxMetaJsonLd()

Adds JSON-LD module metadata managers

For module-based apps, use NgxMetaJsonLdModule instead

provideNgxMetaMetadataLoader()

Allows to load metadata modules after library has been initialized

For module-based apps, use NgxMetaMetadataLoaderModule instead

provideNgxMetaOpenGraph()

Adds Open Graph module basic & optional metadata managers

For module-based apps, use NgxMetaOpenGraphModule instead

provideNgxMetaOpenGraphProfile()

Adds Open Graph module profile metadata managers

For module-based apps, use NgxMetaOpenGraphProfileModule instead

provideNgxMetaRouting()

Allows to manage metadata of a page by specifying it in its Angular's Route.data

For module-based apps, use NgxMetaRoutingModule instead

provideNgxMetaStandard()

Adds standard module metadata managers

For module-based apps, use NgxMetaStandardModule instead

provideNgxMetaTwitterCard()

Adds Twitter Cards module metadata managers

For module-based apps, use NgxMetaTwitterCardModule instead

withNgxMetaDefaults(defaults)

Allows to configure default metadata values.

Use it as part of provideNgxMetaCore()

For module-based apps, check out NgxMetaCoreModule.forRoot()

Interfaces

Interface Description
GlobalMetadata Specifies metadata that will be used by more than one module
GlobalMetadataImage

Specifies image metadata (will be used for link previews / social cards) to be used for more than one module. Like:

- OpenGraph.image (needs standard module)

- TwitterCard.image (needs Twitter Cards module)

Open Graph allows for more attributes for the image. Specify OpenGraph.image if you want to customize those too.

JsonLdMetadata Utility type to provide specific JSON-LD module metadata
MetadataResolverOptions See NgxMetaMetadataManager.resolverOptions
NgxMetaMetaDefinition

Models a <meta> element which NgxMetaMetaService can upsert with a given value (or remove if value is not provided or null)

Can be created with makeKeyValMetaDefinition() and makeComposedKeyValMetaDefinition() factory functions.

NgxMetaRouteData

Utility type to ensure metadata values are set properly inside an Angular's Route.data

You can also provide specific metadata module types to ensure type safety of the metadata values. Open the API to see an example.

OpenGraph Open Graph module metadata values that can be set
OpenGraphImage See OpenGraph.image
OpenGraphMetadata Utility type to provide specific Open Graph module metadata
OpenGraphProfile

Open Graph profile metadata for this page

See OpenGraph.profile

Standard Standard module metadata values that can be set
StandardMetadata Utility type to provide specific standard module metadata
StandardThemeColorMetadataObject See Standard.themeColor
TwitterCard Twitter Cards module metadata values that can be set
TwitterCardCreatorId See TwitterCard.creator
TwitterCardCreatorUsername See TwitterCard.creator
TwitterCardImage See TwitterCard.image
TwitterCardMetadata Utility type to provide specific Twitter Cards module metadata
TwitterCardSiteId See TwitterCard.site
TwitterCardSiteUsername See TwitterCard.site

Variables

Variable Description
JSON_LD_METADATA_PROVIDER Manages the JsonLdMetadata.jsonLd metadata
OPEN_GRAPH_DESCRIPTION_METADATA_PROVIDER Manages the OpenGraph.description metadata
OPEN_GRAPH_IMAGE_METADATA_PROVIDER Manages the OpenGraph.image metadata
OPEN_GRAPH_LOCALE_METADATA_PROVIDER Manages the OpenGraph.locale metadata
OPEN_GRAPH_PROFILE_FIRST_NAME_METADATA_PROVIDER Manages the OpenGraphProfile.firstName metadata
OPEN_GRAPH_PROFILE_GENDER_FEMALE See OpenGraphProfileGender
OPEN_GRAPH_PROFILE_GENDER_MALE See OpenGraphProfileGender
OPEN_GRAPH_PROFILE_GENDER_METADATA_PROVIDER Manages the OpenGraphProfile.gender metadata
OPEN_GRAPH_PROFILE_LAST_NAME_METADATA_PROVIDER Manages the OpenGraphProfile.lastName metadata
OPEN_GRAPH_PROFILE_USERNAME_METADATA_PROVIDER Manages the OpenGraphProfile.username metadata
OPEN_GRAPH_SITE_NAME_METADATA_PROVIDER Manages the OpenGraph.siteName metadata
OPEN_GRAPH_TITLE_METADATA_PROVIDER Manages the OpenGraph.title metadata
OPEN_GRAPH_TYPE_ARTICLE See OpenGraphType
OPEN_GRAPH_TYPE_BOOK See OpenGraphType
OPEN_GRAPH_TYPE_METADATA_PROVIDER Manages the OpenGraph.type metadata
OPEN_GRAPH_TYPE_MUSIC_ALBUM See OpenGraphType
OPEN_GRAPH_TYPE_MUSIC_PLAYLIST See OpenGraphType
OPEN_GRAPH_TYPE_MUSIC_RADIO_STATION See OpenGraphType
OPEN_GRAPH_TYPE_MUSIC_SONG See OpenGraphType
OPEN_GRAPH_TYPE_PROFILE See OpenGraphType
OPEN_GRAPH_TYPE_VIDEO_EPISODE See OpenGraphType
OPEN_GRAPH_TYPE_VIDEO_MOVIE See OpenGraphType
OPEN_GRAPH_TYPE_VIDEO_OTHER See OpenGraphType
OPEN_GRAPH_TYPE_VIDEO_TV_SHOW See OpenGraphType
OPEN_GRAPH_TYPE_WEBSITE See OpenGraphType
OPEN_GRAPH_URL_METADATA_PROVIDER Manages the OpenGraph.url metadata
STANDARD_APPLICATION_NAME_METADATA_PROVIDER Manages the Standard.applicationName metadata
STANDARD_AUTHOR_METADATA_PROVIDER Manages the Standard.author metadata
STANDARD_CANONICAL_URL_METADATA_PROVIDER Manages the Standard.canonicalUrl metadata
STANDARD_DESCRIPTION_METADATA_PROVIDER Manages the Standard.description metadata
STANDARD_GENERATOR_METADATA_PROVIDER Manages the Standard.generator metadata
STANDARD_KEYWORDS_METADATA_PROVIDER Manages the Standard.keywords metadata
STANDARD_LOCALE_METADATA_PROVIDER Manages the Standard.locale metadata
STANDARD_TITLE_METADATA_PROVIDER Manages the Standard.title metadata
TWITTER_CARD_CARD_METADATA_PROVIDER Manages the TwitterCard.card metadata
TWITTER_CARD_CREATOR_METADATA_PROVIDER Manages the TwitterCard.creator metadata
TWITTER_CARD_DESCRIPTION_METADATA_PROVIDER Manages the TwitterCard.description metadata
TWITTER_CARD_IMAGE_METADATA_PROVIDER Manages the TwitterCard.image metadata
TWITTER_CARD_SITE_METADATA_PROVIDER Manages the TwitterCard.site metadata
TWITTER_CARD_TITLE_METADATA_PROVIDER Manages the TwitterCard.title metadata
TWITTER_CARD_TYPE_APP See TwitterCardType
TWITTER_CARD_TYPE_PLAYER See TwitterCardType
TWITTER_CARD_TYPE_SUMMARY_LARGE_IMAGE See TwitterCardType
TWITTER_CARD_TYPE_SUMMARY See TwitterCardType

Type Aliases

Type Alias Description
MetadataSetter See NgxMetaMetadataManager.set
MetadataSetterFactory Utility type for a function that returns a MetadataSetter provided some dependencies (which should be able to be injectable)
MetadataValues Defines the metadata values to use for a page. Broadly speaking, it's just a JSON object
NgxMetaMetaContent

Content to be set for a specific <meta> element in the page

Can be undefined or null. In that case, the element will be removed.

See NgxMetaMetaService

OpenGraphProfileGender Genders for OpenGraphProfile.gender property
OpenGraphType Types for OpenGraph.type property
StandardThemeColorMetadata See Standard.themeColor
TwitterCardCreator See TwitterCard.creator
TwitterCardSite See TwitterCard.site
TwitterCardType Card types for TwitterCard.card property