user3314402
user3314402

Reputation: 254

AngularJS and SEO - Setting Different Meta Description Tags for each partial?

For a simple example of my situation, let's say I have a Sign Up partial page ('/signup') and a Sign In ('/signin') partial page.

For the sign up partial, I want the meta tag to be:

<meta name="description" content="Sign Up">

For the sign in partial, I want the meta tag to be:

<meta name="description" content="Sign In">

In my main index.html file, I have the ng-view tag is that is nested inside the body tag where the partials will be displayed. Since the partials are inside the body tag and the header tag (where you would normally put metatags for static files) is outside, how do I set Meta Description Tags for each partial using AngularJS?

If anyone could help me with a sample code, that would be great as I am totally stuck. :(

Upvotes: 0

Views: 1274

Answers (1)

skewl84
skewl84

Reputation: 184

Are you needing to do this for SEO purposes If yes, don't try to do it via angularjs because the search engine crawlers don't allow any javascript code to be run.

Instead look at implementing the hashbang and server side approach.

Look at this article: http://www.yearofmoo.com/2012/11/angularjs-and-seo.html

Upvotes: -4

Related Questions