Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Mojtaba Reyhani on
How can I show only "read more" link just in node teaser, and remove or unset other links like "add new comments" or "2 Comments" at the end of a node teaser?
Comments
links.html.twig
Shift focus from node template to
links.html.twig
, there you have access to an items array and can limit what is printed in a suggestion, e.g.links--node.html.twig
, also you can use the preprocess function to set up new variables, or a module to generate only the links you want, e.g. for things like number of views.I don't have time to write code to show you how to do this etc, perhaps someone else has some time to help you further.
Pimp your Drupal 8 Toolbar - make it badass.
Adaptivetheme - theming system for people who don't code.
Simply use {{ url }}
<a href="{{ url }}">read more</a>
language
a disadvantage of simple use, the 'read more' text is not language dependent.
the t filter is also not a solution, all suggestions are more than welcome.