angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

SEO Guidance and/or Solution?

Open jmlivingston opened this issue 10 years ago • 23 comments

What is the recommendation for implementing SEO within an angular-cli site?

Current Problem

Implementing a SEO friendly solution for a SPA application typically requires server side rendering or possible pre-building static HTML files. This ensures the meta tags are populated when crawled by by search engines like Google, Bing, and Yahoo and when shared with social media sites like Facebook, LinkedIn, and Google+.

Note: There are some trends of search engines being more forgiving of SPA applications, but this is not true of all of them. Anecdotally, I have found Google and Facebook very tolerant, but LinkedIn to be terribly intolerant.

Possible Solutions?

- Angular Universal + angular-cli - Ultimately this marriage would be ideal, though it’s not clear when this will happen. - Host using a different technology - For example, for a .NET application, we could use an index.aspx and server side data-binding to add the meta tags based on the initial server request. The one drawback is this data would need to come from somewhere and match the routing table of our client side code. - Use Existing Solution - This would be ideal as we don't have to rely on 3rd parties. Since angular-cli is already using Express and Handlebars (what?), we could use server side rendering to generate the index.html based on some pre-determined data. This data can come from a configuration file which mimics the client side routing (probably not ideal), or reads existing Angular routing classes that have been decorated with SEO properties. While we could create a standard for this, perhaps some kind of hook that would allow an angular-cli middleware plug-in would be ideal.

Sample SEO Tags title tag: Example: New York Times - Cooking

meta tag names: Example:

  • meta:title
  • meta:description
  • meta:keywords
  • meta:author
  • meta:og:type
  • meta:og:site_name
  • meta:og:url
  • meta:og:title
  • meta:og:description
  • meta:og:image
  • meta:twitter:card
  • meta:twitter:url
  • meta:twitter:title
  • meta:twitter:description
  • meta:twitter:image:src

jmlivingston avatar Nov 04 '16 01:11 jmlivingston

if I run ng serve --app 1 I am getting

ng serve for platform server applications is coming soon!

@Toxicable any idea when we will get that support?

chintan13 avatar Oct 27 '17 18:10 chintan13

Closing this in as Universal builds are supported.

@chintan13 serve is not coming in the next release, but you can already do it yourself. There are tutorials online for it.

hansl avatar Feb 20 '18 19:02 hansl

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.