4

I have some initial static items and more dynamic items of the same kind are loaded in later in a never ending scroll-type situation. This works really well in my webpage without the initial static items, but now I want to add them in as they contain really good crawlable content.

My first idea was to simply start my ng-repeat after that static content. This however will not work for my page since there are filtering options and hide/show's based on the models I want to attach to this static content. Something like this:

<li>
    <a href="path/">How to jump rope</a>
    <p truncate-directive>This article is about jump roping lorem ispum dolor amet...</p>
    <a ng-show="item.admin">edit</a>
</li>
<li ng-repeat="item in items">
    <a>{{item.title}}</a>
    <p truncate-directive>{{item.description}}</p>
    <a ng-show="item.admin">edit</a>
</li>

The second li has the model attached and the first doesn't and is outside the model's scope, so I can't use angularJS to sort it, filter it etc.

I don't mind writing over the static items with dynamic versions of themselves if that makes it easier. I just want crawlable/static versions of some items on page load before the JavaScript parses.

I don't know how to do this though.

4

1 回答 1

1

一种可能的解决方案是手动将静态内容放置在页面上(就像您在第一个中所做的那样li),然后ng-hide="true"在 angular 开始解析页面时使用类似隐藏内容的方法。这将允许爬虫查看信息,但会阻止将其显示给用户。然后,只需将静态内容添加到您的模型中,并允许它与您的动态内容一起加载。

此外,感谢 check_ca 提供了指向Google 指南以使 AJAX 页面可抓取的链接!

于 2013-08-03T06:59:37.480 回答