3

I want to encourage visitors to create an account by allowing them to read the teasers on the front page and know that creating an account is worth their effort to access the rest of the content.

i'm using v7.x

P.S. I also hope this will enable Search engines to see enough content to index properly

  • 2
    If search engines can find your content, then users can find your content. You won't be able to hide your content and have it indexed by search engines (at least not through the use of a normal web site anyway). Anything you did would be cosmetic only – Clive May 9 '12 at 10:01
2

One way to do this is to use Panels. Override the front page and the default node template; create two variants for each, one for anonymous and one for authenticated users (using selection rules).

Then, for the front page for anonymous users, only use teasers and remove the links to the full content. For the anonymous node template, limit everything to teasers.

For authenticated users, enable everything just as you'd like them to see it.

Note: this is not a full tutorial on Panels, but should hopefully provide some hints to get you started.

  • Keep in mind that doing this will cut the search engines off from your non-teaser content as per Clive's comment.
2

The Premium content module allows you to restrict access to the content body by role, but show teasers to all.

From the project page:

This is useful on a news or membership site where teasers are available to the general public but the full body is only available to privileged users. Premium nodes appear in listings with full title and teaser available to anyone. If a user does not have adequate privileges, the default behavior is to show a simple message, but you can use Panels or theme overrides to do more custom things.

0

Sadly, Drupal's node access rights system does not support such granularity.

But, using an implementation of hook_node_view_alter() to alter the renderable array used to view a node in any context that uses node_view() (like the /node/%nid pages do), you can ensure that anonymous users don't have access to full view of a node (ie. $build[view_mode] == 'full'). To disable an element, simply set it #access property to FALSE. For some of them (body), it should also be possible to alter the theme variable to, for instance, render them as teaser text (vs. full text).

In order to support full content indexation by external search engine (such as Google), you will need to disable page caching. Otherwise, a search engine indexer may see an incomplete page generated for a normal anonymous, or the reverse. You also have to find a way to instruct Drupal to produce an authenticated user page when the request comes from a search engine indexer. If you use custom code to disabled full rendering of the body (like I suggest), you can do this be having a condition that only filter out anonymous users who are not indexers. Another solution may be to find a trick to lure Drupal into automatically logging search engine bot as special authenticated user (but I don't known how).

  • 2
    Serving up different content to a spider vs a normal web user can be grounds for ranking penalties. – mpdonadio May 9 '12 at 13:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.