Skip to content

Standard

This module allows managing HTML <meta> tags whose name attribute is defined in the HTML specification and the site's <title>. We call those standard meta tags

Setup

Depending on what metadata you need to set, add one of more of the following providers.

Main

Standalone, module-free apps

This is the default approach for authoring Angular projects generated with Angular CLI v17 and above. It's also the recommended way to author Angular projects right now. Using standalone APIs is the preferred and recommended way to do so. You can use standalone APIs too despite the application is still module-based. Learn more about standalone at standalone components guide and standalone migration

Add provideNgxMetaStandard() to your standalone app's app.config.ts file providers. Check out get started setup for more details.

app.config.ts
import {provideNgxMetaStandard} from '@davidlj95/ngx-meta/standard';

export const appConfig: ApplicationConfig = {
  // ...
  providers: [
    // ...
    provideNgxMetaCore(),
    provideNgxMetaRouting(), // (optional)
    provideNgxMetaStandard(),
    // ...
  ],
}
Non-standalone, module-based apps

This is the default and traditional approach for authoring Angular projects generated with Angular CLI before v17. It's not the preferred or recommended way to author Angular projects right now. Using standalone APIs is the preferred and recommended way to do so. You can use standalone APIs too despite the application is still module-based. Learn more about standalone at standalone components guide and standalone migration. You can anyway keep using the module-based equivalent APIs for now if you prefer to do so.

Add provideNgxMetaStandard() to your module-based app's app.module.ts file. Check out get started setup for more details.

app.module.ts
import {provideNgxMetaStandard} from '@davidlj95/ngx-meta/standard';

@NgModule({
  // ...
  providers: [
    // ...
    provideNgxMetaCore(),
    provideNgxMetaRouting(), // (optional)
    provideNgxMetaStandard(),
    // ...
  ],
  // ...
})
export class AppModule {}

Metadata

To check all the metadata that can be set with this module, check out

Standard API Reference

Utility type

Following Typescript type will help you provide metadata values:

import { StandardMetadata } from '@davidlj95/ngx-meta/standard'

const metadata = {
  standard: {
    keywords: ['cool', 'site'],
  },
} satisfies StandardMetadata

StandardMetadata API Reference

Resources