How can show only "read more" link in node's teaser, and remove or unset other links like "add new comments" or "2 Comments" at the end of a node teaser?

2 Answers 2


There are two ways to do this:

  1. Through PHP. This is the correct way. The code below would go in your theme's .theme file.

    function YOUR_THEME_preprocess_links(&$variables) {
      // Determine which links should be removed. These are CSS classes, because
      // they are used as keys in the $variables['links'] array.
      $links_to_remove = array(
        // X comments link.
        // X new comments.
        // Add new comment.
      // Loop through the links and remove them.
      foreach ($variables['links'] as $css_class => $link) {
        if (in_array($css_class, $links_to_remove)) {
  2. Through CSS. This is not the best way, but is faster:

    .your-node-selector .node__links li.comment-comments,
    .your-node-selector .node__links li.comment-new-comments,
    .your-node-selector .node__links li.comment-add {
      display: none;
  • Thank you very much for your kindness, My problem was solved. Feb 28, 2016 at 10:12

If I remember correctly, Drupal 8 uses views to display teasers.

If that is the case, all you have to do is edit the teaser view and change Content: Teaser to Content: Fields and then just add the fields you want. Basically, you can create your own custom teaser.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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