I got a problem with the Meta function of Angular.
import {Meta} from '@angular/platform-browser';
I have added it on my page "contact.component.ts" but I'm not seeing anything on my web page. There is no meta description or something else.
This is my page code:
import {Meta} from '@angular/platform-browser';
@Component({
selector: 'app-contact',
templateUrl: './contact.component.html',
providers: [],
styleUrls: ['contact.component.css']
})
export class ContactComponent implements OnInit {
constructor(public meta: Meta, public http: Http, public router: Router, public RequestService: RequestService, public global: GlobalService) {
this.meta.addTag({ name: 'description', content: 'This is metadata' });
}
ngOnInit() {
this.global.redirectionIfNoConnecte();
this.global.getJsonLanguage();
}
}
Can you save me ? :(
Refer to this 2017 Talking Dotnet blog post:
The HTML meta tag provides metadata about the HTML document. Metadata aren’t displayed on the page but are machine parsable. Meta elements are typically used to specify the page description, keywords, author, last modified, and other metadata. The metadata can be used by browsers (how to display content or reload the page), search engines (keywords), or other web services. Meta tags play an important role in SEO. [...]
This is an another helpful link on how the meta tags are used.