jvandemo / angular-update-meta Goto Github PK
View Code? Open in Web Editor NEWDynamically update meta tags for SEO purposes in your AngularJS application. Supports prerender.io.
License: MIT License
Dynamically update meta tags for SEO purposes in your AngularJS application. Supports prerender.io.
License: MIT License
Is it only me? Ive spent a good 2 hours trying to get update-link directive to work.
I checked the documentation and examples and have rechecked my code at least 10 times, even had a peek into the release to check the directive was there! (Sadly the plunker hasnt been updated to include any working update-link examples - although i have COPIED the documentation examples into my page and they dont work.)
In my index.php I have the default tags in my head which includes the meta properties as well as the link rels.
In my gallery subpage/subdirectory I have included the update-meta and update-link directives as given in the example.
this results in the meta tags being updated, while the link tags remain as in the 'default' values in the head of the document.
....?!?....
Could somebody please create a working update-link plunker?
I have tried the example provided but only the title works. I am using https://moz.com/tools/seo-toolbar to check for the meta tag whenever i update them but only the title works. I have tried to added them to the layout and other views but it didn't work out.
Currently there is no way of adding <title></title> Tag in the head. If this is included then it will be very helpful.
If you overwrite default meta values from within a view; navigating off of that view to one without any update-meta does not return the page meta values to their original values.
For example, if the default title tag in my template is set to:
<title>My Lovely Company</title>
... and I overwrite that title from within the /contact view:
<update-title title="My Lovely Company | Contact us"></update-title>
When I navigate away from the /contact view to a view without any overwrites, the DOM title remains:
<title>My Lovely Company | Contact us</title>
Is this intended behaviour? In which case, it requires that all views that can make do with the default meta data have their own update-meta overwrites. Subsequent app wide changes to the default meta data will then need to be updated in all the 'vanilla' views also.
The angular site: http://ec2-52-77-225-241.ap-southeast-1.compute.amazonaws.com/article/poor-left-behind-at-climate-talks is using (successfully) this directive and the tags are being updated. However when I try sharing it (the post share is currently using the feed method) I get the default meta tags.
Even facebook debugger is not showing the current tags..
Also, the facebook sharing on Disqus is not working as it is using Facebook share dialogue.
Could someone shed some light on what's happening?
Can there be a functionality where we set default tags which are adopted by all pages?
Right now, meta information has to be provided for all pages.
views title and meta tags updated perfectly using updateMeta. But after reload the website then everything is updated in views but title only changes i mean template title updated to view title after particular seconds. Initially it is showing the correct view page title but after 2 seconds it is showing template title but other meta tags are not changing only title is having this problem. Other than this issue everything is working fine . Please help me to fix the issue.
Does the Open Graph support imply that social media networks such as Facebook will scrape the correct information if the properties are set?
In the Google search title is changed to each page. but the description will remain same as in index.
Description is changing in developer tool.
I have following code in my index.html
<meta property="og:title" content="Lorem ipsum dolor sit amet" /> <meta property="og:type" content="website" /> <meta property="og:url" content="http://www.example.com/home.html" /> <meta property="og:image" content="https://faisal080.files.wordpress.com/2012/11/marcus_2545603.jpg?w=640&h=480" /> <meta property="fb:app_id" content="1673863836197303" />
I have following code in my view:
<update-meta property="og:title" content="{{vm.title}}"></update-meta> <update-meta property="og:type" content="website"></update-meta> <update-meta property="og:url" content="{{vm.location}}"></update-meta> <update-meta property="og:image" content="{{vm.image}}"></update-meta>
When I open my view in browser, meta tags are updated correctly in DOM but when I copy view URL here https://developers.facebook.com/tools/debug/
it always fetch content from index.html. In other words it always take og:url from index.html.
Can you please guide me what I am doing wrong ?
Does this plugin support updating multiple values for the same property? For example,
<update-meta property="article:tag" content="one" />
<update-meta property="article:tag" content="two" />
<update-meta property="article:tag" content="three" />
<update-meta property="article:tag" content="four" />
Right now it seems like if there's an array, each update overwrites the last, so that what shows up is just
<meta property="article:tag" content="four">
<meta property="article:tag" content="">
<meta property="article:tag" content="">
<meta property="article:tag" content="">
even if I've defined
<meta property="article:tag" content="">
<meta property="article:tag" content="">
<meta property="article:tag" content="">
<meta property="article:tag" content="">
Hello,
How to update the meta content in controller ?
Thank you
@jvandemo
I have added image tag to have a certain image appear when sharing to Facebook
<meta name="og:image" content="assets/images/background.jpg" />
. This works well when I share the homepage but whenever I share any other page, no image appears. The title and the description appear correctly but no image appears. Not the even the home page one.
Here's what I am doing when trying to update the image:
<update-meta name="og:image" content="{{property.property.images[0].image_path}}"></update-meta>
Any idea how can I debug this issue further?
Hello, I have used angular meta tag into my angularjs app, but when I check on card validator for Facebook or Twitter, it's not working. The page keep the content of default meta tag.
I have questions on how to use update-meta tag :
Now you can use the following markup in your view(s):
Here is an example of my meta tag :
<meta property="fb:app_id" content="MY_APP_ID" />
<meta property="og:url" content="MY_URL_BASE" />
<meta property="og:type" content="MY_TYPE" />
<meta property="og:title" content="My_DEFAULT_TITLE" />
<meta property="og:description" content="MY_DEFAULT_DESCRIPTION" />
<meta property="og:image" content="MY_DEFAULT_IMAGE" />
<meta property="music:duration" content="" />
<meta property="music:album" content="" />
<meta property="music:album:track" content="" />
<meta property="music:musician" content="" />
<update-meta property="og:description" content="{{ description }}"></update-meta>
<update-meta property="og:image" content="{{ image }}"></update-meta>
<update-meta property="music:duration" content="{{ duration }}"></update-meta>
<update-meta property="music:album" content="{{ album }}"></update-meta>
<update-meta property="music:album:track" content="{{ title }}"></update-meta>
<update-meta property="music:musician" content="{{ artist }}"></update-meta>
Thanks.
Hi, I have implemented this into my angularjs app however, the update-meta tag is not working, it does not update my meta tags.
It is weird because update-title works, only the update-meta dosent work.
Help would be much appreciated.
Thanks
Please consider changing:
angular.element('meta[name=' + scope.name + ']').attr('content', scope.content);
to
angular.element('meta[name="' + scope.name + '"]').attr('content', scope.content);
The double quotes will allow the jquery selection to include something like 'twitter:title'
There is no main
property in NPM package so this
import 'angular-update-meta';
rises error.
Oh, it's due to NPM package version is 1.8.0
, please update it.
Can (or Will) this module update an attribute of the html tag like the lang for example: ?
Hi @jvandemo, thanks for creating this plugin. As soon as I add the line <update-meta name="apple-mobile-web-app-status-bar-style" content="black">
in my view template, I get the following error:
Error: [jqLite:nosel] Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element
In your directive, the line angular.element('meta[name=' + scope.name + ']')
triggers the error in my debug mode. I also try to include jQuery but does not resolve the issue. Would you advise what goes wrong here? My AngularJS is at version 1.4.3.
I would take benefits of an option that would reset the tags content, before any state change.
For example, I use open-graph meta in few states on my application. I expect them to be empty in other states ; by now to make it work I must add
in any state.
Working with Angular 9
Added meta tag in index.html , now from other pages i am trying to update metatag from component to share it on LinkedIn.
They are updated when i check using inspect element. but on linked in it is not show updated one.
Unlike other npm packages, this package does not yet support the ES6 simple import, as in:
import 'angular-update-meta';
note that it's possible to work around it with:
import 'angular-update-meta/dist/update-meta'
Anyway, adding a 'main' key to package.json should solve it:
"main": "dist/update-meta.js"
It is possible to update the canonical and hreflang tags too?
Regards,
J. Carlos
The file bower.json
should be update to use the lastest version of AngularJS 1.4.*.
"dependencies": {
"angular": "~1.2.21"
},
"devDependencies": {
"angular-mocks": "~1.2.21",
"angular-scenario": "~1.2.21"
}
I tested without the dependencies with the lastest version of AngularJS, works like a charm.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.