How can I show only read more link, and remove or unset other links like "add new comments" or "2 Comments" at the end of a node teaser?
Asked
Active
Viewed 2,356 times
0
-
Have you tried doing something for yourself first? – António Ribeiro Feb 28 '16 at 09:52
-
yes, I'm try doing somting for myself. – Mojtaba Reyhani Feb 28 '16 at 10:07
-
Then, please, update your post with what you've done so far. – António Ribeiro Feb 28 '16 at 10:08
-
I Foud a soluton here: [link](http://http://drupal.stackexchange.com/questions/192878/show-only-read-more-link/192886?noredirect=1#comment232876_192886) **But doesn't work properly**. – Mojtaba Reyhani Feb 28 '16 at 10:53
1 Answers
1
In order to have custom links, you need the links--node.html.twig template file, it does theme override to display node links.
1. Paste this:
This is links.html.twig talking....
{% if links -%}
{%- if heading -%}
{%- if heading.level -%}
<{{ heading.level }}{{ heading.attributes }}>{{ heading.text }}</{{ heading.level }}>
{%- else -%}
<h2{{ heading.attributes }}>{{ heading.text }}</h2>
{%- endif -%}
{%- endif -%}
<ul{{ attributes }}>
{%- for key, item in links -%}
<li{{ item.attributes.addClass(key|clean_class) }}>
{%- if item.link -%}
{{ item.link }}
{%- elseif item.text_attributes -%}
<span{{ item.text_attributes }}>{{ item.text }}</span>
{%- else -%}
{{ item.text }}
{%- endif -%}
</li>
{%- endfor -%}
</ul>
{%- endif %}
into your editor
2. Customise at will.
3. save as themes/YOUR_THEME/templates/links.html.twig
4. clear cache
5. See it in action
Thanks for your feedback.

Augusto
- 2,125
- 18
- 27
-
I have such as this file in my templates directory in my theme folder as Default, but I do not know how to customize it, Can you help me to reach my goals with give more information about this problem. – Mojtaba Reyhani Feb 29 '16 at 09:16
-
Since it would be your next step, I suggest you to post a new question providing what you expect the links--node.html.twig should produce. In the meantime, thanks for feedback on my reply. – Augusto Feb 29 '16 at 09:32