CaptainCodeman / app-metadata

Manage page meta tags for SEO
http://captaincodeman.github.io/app-metadata/
31 stars 6 forks source link

Support Polymer 2.0 #5

Open ankitkante opened 7 years ago

ankitkante commented 7 years ago

Hi The syntax used to declare the app-metadata element is of Polymer 1.x. Do you plan to update the code to Polymer 2.0? If not, what is your opinion on the compatibility of this element with Polymer 2.x

CaptainCodeman commented 7 years ago

Maybe checkout the 2.0-preview branch where it should be available as a pure-webcomponent (for any framework) and also Polymer 2.0. I've been waiting for Google to index a site to test it.

https://github.com/CaptainCodeman/app-metadata/tree/2.0-preview

ankitkante commented 7 years ago

Hi I tried this branch. The problem I am facing is this: Suppose when I route to a page and set the meta tags as follows (this.content is received from the server):

let meta = document.querySelector('app-metadata');
meta.data = {
              'title': this.content.name,
              'description': this.content.short_description,
              'og:title': this.content.name,
              'og:description': this.content.short_description,
              'og:image': this.content.cover_img_path,
};

Now, after this is done, I can see the meta tags in my html. Now, there is a separate REST API that I call to get the content of the meta tag og:url. So, my question is: How do I set this value without disturbing the previously set meta tags. I tried the following code,but,it doesn't work:

meta.data['og:url']= this.shareUrl;
CaptainCodeman commented 7 years ago

Make whatever code sets the metadata depend on both pieces.