Data Browser - Viewing Site  Sector 23 Code Bank Logged in as:  Guest  




           


How to add meta tags like keywords to an Angular 11 page
In Angular 11+, simply inject the Meta service and do what you like with it.
Example:

constructor(private http: HttpClient, @Inject('BASE_URL') private baseUrl: string, private meta: Meta) {
meta.addTags([
{ name: 'description', content: 'Word Square Generator' },
{ name: 'author', content: 'Dcodr Wordsmithing Tools' },
{ name: 'keywords', content: 'Word Square, Generator, Sator, Cipher, Encrypt, Decrypt' },
]);
}

What about the page Title? That is now set in your routing (app.module.ts):
Example:

RouterModule.forRoot([
{ path: 'word-square-generator', component: WordSquareGeneratorComponent, title: 'Word Square Generator' },

Created By: amos 7/29/2023 12:03:17 AM
Updated: 7/29/2023 12:03:40 AM