-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add meta for property and itemprop. #8
base: master
Are you sure you want to change the base?
Conversation
Hi there, thanks for your contribution! A few thoughts:
this.document.querySelector(`meta[${attributeName}='${tagName}']`);
setTitle(title?: string, titleSuffix?: string) {
const titleElements = [_getOrCreateMetaTag('title', 'name'), _getOrCreateMetaTag('og:title', 'name')];
if (this.metaConfig.enableMetaProperty) {
titleElements.push(_getOrCreateMetaTag('title', 'property'));
titleElements.push(_getOrCreateMetaTag('og:title', 'property'));
}
//let titleStr = ....;
titleElements.forEach((titleElement: HTMLElement) => {
titleElement.setAttribute('content', titleStr);
});
Thanks for creating a PR |
@vinaygopinath I'm not an expert. I prefer something that just works without the need to config, opt in or deeply understand all 3 tagging systems. What's the down side of just slap all of them on there? |
I think ng2-meta, as an open-source library, should be maintainable, customizable to the needs of different developers and follow best practices. Creating multiple functions that essentially do the same thing, forcing the creation of meta tags that some folks might not want and using schema.org attributes in ways that might not be recommended would defeat those intentions. What's the downside if we "slap all of them on there"? It'll be harder to maintain this code (Why is there duplicated code?), someone might create an issue to disable some tags (I don't use schema.org/microdata attributes. How can I disable them?) and sites would fail w3c validation. Having said that, if it's important for you to quickly implement this within your site, I encourage you to use your fork in your project via npm or other package managers. |
@vinaygopinath My comment about "slap all of them" is for all 3 types of tags. The duplicated code part I agree should be written better and not duplicate. It's about by default having all types of tags a website could want VS by default just have 1 set. Is your concern about "some folks might not want some tags" even valid? I cannot think of such a scenario. And if it happens some time, how frequent? IMHO, we cover the use cases for majority people, which is slap all the tags you can think of on the html, I don't care. And then maybe provide a way for a very small percentage of particular user to remove unwanted tags. |
We have 3 popular set of meta format: "name", "property" and "itemprop".
Currently only name is set. This change allows all 3 to be set at the same time.
It is very important because facebook use "property" and google use "itemprop" (from schema.org)