app-metadata icon indicating copy to clipboard operation
app-metadata copied to clipboard

Support Polymer 2.0

Open ankitkante opened this issue 8 years ago • 3 comments

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

ankitkante avatar Aug 22 '17 17:08 ankitkante

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

CaptainCodeman avatar Aug 22 '17 17:08 CaptainCodeman

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;

ankitkante avatar Aug 23 '17 03:08 ankitkante

Make whatever code sets the metadata depend on both pieces.

CaptainCodeman avatar Aug 23 '17 15:08 CaptainCodeman