本文介绍了Angularjs网站不是索引谷歌上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了超过20页的大angularjs应用程序,并添加一些SEO的标签。但它不是运作良好。大多数的网页内容也将填充使用JavaScript。
这就是我如何实现SEO标签为每个网页。

I developed a large angularjs application with more than 20 pages and add some SEO tags. But it is not functioning well. Most of content of the pages also populate using javascript.This is how I implemented SEO tags for each pages.

app.js

(function() {

var app = angular.module('myApp', ['ngRoute', 'ngSanitize', 'angular-flexslider']);

// config route
app.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
    var baseUrl = "partials/";

    $routeProvider.when('/', {
        title: 'Title 1',
        metadescription: "Description 1",
        metakeywords: "Keyword 1",
        templateUrl: baseUrl + 'home.html',
        controller: 'homeCtrl'
    })
    .when('/page1', {
        title: 'Title 2',
        metadescription: "Description 2",
        metakeywords: "Keyword 2",
        templateUrl: baseUrl + 'page1.html',
        controller: 'page1Ctrl',
    })

    .otherwise({
        redirectTo: '/'
    });

    $locationProvider.html5Mode(true);
    $locationProvider.hashPrefix('!');
}
]);

app.run(['$location', '$rootScope', function ($location, $rootScope) {
    $rootScope.$on('$routeChangeSuccess', function (event, current, previous) {
        $rootScope.title = current.$$route.title;
        $rootScope.metadescription = current.$$route.metadescription;
        $rootScope.metakeywords = current.$$route.metakeywords;

    });
}]);

}());

的HTML Meta标签已经实现如下:

Meta tags of the html have implemented as follows

<!DOCTYPE html>
<html lang="en" ng-app="lennonsApp">
<head>
<base href="/">
<meta charset="utf-8">
<title ng-bind="title"></title>
<meta name="description" content="{{metadescription}}">
<meta name="keywords" content="{{metakeywords}}">
<meta name="fragment" content="!">
</head>

<body>
   Content goes here.....
</body>
</html>

所有的meta标签数据绑定都正常工作时,页面loads.But甚至,一个月后我的网站是不是在搜索引擎搜索。
本网站托管IIS服务器上。
我的问题:
1)。就是这种方法对搜索引擎的工作吗?
2)。做我需要做的IIS服务器的任何其他特定配置的angularjs应用程序?
3)。可任何一个建议的任何其他方法支持SEO

All the meta tags data bindings are working properly when page loads.But even after one month my website is not searching in search engines.This web site is hosted on IIS server.My questions:1).Is this method working on search engines?2).Do I need to do any other specific configurations for IIS server for angularjs application?3).Can any one recommend any other method support SEO

在此先感谢

修改
我试着google.com网站:[域名],没有如上实施SEO标签不受影响。

EditI tried google.com site:[domain name], none of the seo tags implemented as above is not effected.

修改
是否有任何事情与IIS服务器?

EditAre there any thing to do with IIS server ?

推荐答案

在水疗SEO执行是不平凡的,而不是所有的搜索引擎支持它当前我认为谷歌,也许兵能够抓取SPA的,但有些工作需要是该做的。
有几种方法可以做到这一点:

SEO implementation on SPAs is not trivial and not all search engine support it currently i think google, and maybe bing are able to crawl SPA's but some work needs to be done for that.there are several methods you can do this:

1 use !# for your angular routes instead of  just #
2 use html5 routes instead of # routes
3 detect crawlers on your server and serve the metadata
4 create snapshots of your site and serve them

基本上这些都是大部分的选项
你可以在这些文章中找到更多细节。

basically those are most of your optionsyou can find more details in these articles


这篇关于Angularjs网站不是索引谷歌上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 10:33
查看更多