ui-router-metatags
Metatags support for the AngularUI Router
Heavily inspired by tf-metatags and angular-ui-router-title.
Google updated they crawler to execute javascript, so if you use this component then your pages will be indexed by google. However, other crawlers - search engines or social services like facebook - still need to see the page after being rendered by javascript. Therefor it is still recommended to use a service like prerender.io
Installation
$ npm install ui-router-metatagsor$ bower install ui-router-metatags
Documentation
See the sample app for a complete example, otherwise, read below
Include the script in your index file
Include it in your module declaration and in your run block
angular; { $rootScopeMetaTags = MetaTags;} angular ;
Add the tags to your index file
Default title
Then configure defaults
{ UIRouterMetatagsProvider ;} angular ;
(Static properties are added to all pages and the "setOGURL" method ensures that a 'og:url' property is added to all pages.)
And finally decorate the routes with metatags in the route configs like so:
{ $stateProvider ; }angular ;
Note that all tags can be either a simple string, a resolve function or a interpolated string (where the properties available are the ones you resolve in your route).
Log statement
Please note that any routes without metatags will cause a debug log statement, so remember to disable debug logging in production. Example of such a log statement:
MetaTags - route: "app.dashboard" does not contain any metatags
To develop
Install nodejs and the following packages globally:
- gulp
- typings
then run:
- npm install
- typings install
Then finally, run "gulp"