Crawl ng-view in angular js

2019-08-30 03:22发布

I am developing a static website in AngularJS and I am stuck on an SEO issue. Basically my google webmasters tools tell that there are no crawl errors however when I try to fetch different routes it always returns the same home page result. It doesn't read what is injected in the ng-view div. It just shows the static text in my index.html file. The weird thing is that it actually reads my directive of the landing page '/' because when it renders it reads my navbar, footer, and content, which I have put in an "index-widget" directive but as I said it reads nothing from the ng-view directive. Any help would be appreciated. Here is the page http://luxtest.tk Thanks

1条回答
对你真心纯属浪费
2楼-- · 2019-08-30 04:02

Your site is using # urls (eg http://luxtest.tk/#/kontakti) - Google bot will not see these as separate pages. You have two options:

Switching to HTML5 mode is easier if you can set your hosting up appropriately to point all url's at the index.html page. Switching to HTML5 mode is done in the config for the app:

    angular.module('test', [])

        .config(function($locationProvider) {
            // use the HTML5 History API
            $locationProvider.html5Mode(true);
        });
查看更多
登录 后发表回答