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

A possible solution would be to place the static content on the page manually (like you do in your first li) and then use something like ng-hide="true" to hide the content as soon as angular begins to parse the page. This will allow the crawlers to see the information, but it will prevent it from being displayed to users. Then, simply add the static content to your model and allow it to load along with your dynamic content.

Also, thanks to check_ca's for providing a link to Google's guide to making AJAX pages crawlable!

于 2013-08-03T06:59:37.480 に答える