2

I have just set up a new website with Drupal 8. I created a new content with a regular HTML that contains basic text. I promoted it to homepage, I see a "read more" link. But there is no "more" to read.

How can I remove "Read more" link if there is no more content to read?

I found some modules for Drupal 7 but I am following a certain solution for this general problem.

And also I am curious; isn't it obvious that there shouldn't be a "read more" link when there is no more content? Is it a bug or something?

3
  • 1
    I do not believe it is a bug. I think the read more link is just a regular link, Drupal assumes that your content will not be that short. I don't think there is a way unless you use a contrib or custom module.
    – No Sssweat
    Oct 27 '16 at 13:31
  • 3
    You could change in the view "Frontpage", how the content is displayed from teaser to full content, because the "Read more" link is only put in teasers.
    – 4k4
    Oct 27 '16 at 14:31
  • When you promote something to the front page in the form of a teaser, it's going to output the read more, as it's in teaser format and expects you to have full output of that content somewhere.
    – DMAC
    Oct 27 '16 at 14:57
2

Neither of the other answers actually addresses the question, which is how to turn off "read more" selectively depending on whether there is more to read or not.

The standard read more link, as the comments in NodeViewBuilder say, is always displayed on a teaser by default because there is no (easy) way to know how the teaser content differs from the full view. Your content type might have several other text fields apart from the body which are only shown on the full page view.

However, it should be possible to implement a custom "read more" link that has the behaviour you seem to be asking for. I don't think anyone has implemented one yet, but the most fruitful approach would be a modest extension of the "summary or trimmed" field formatter, although you could probably also do something in a preprocess hook in your theme.

Edit: A demonstration module is up on github now. It's not perfect and I would like to refactor it and possibly make it more general-purpose but it works for the simplest case.

0
0

Well, in Drupal 8 it is quite simple to remove "Read more" link for some content type. In this example I took "Article" type.

Just navigate to "Structure" > "Content types" in "OPERATIONS" column select "Manage display" for type you need to hide "Read more" link. Note which dispay type you are editing (Default, RSS, Teaser)...

So your URL will look like: /admin/structure/types/manage/article/display/teaser and from there drag "Links" row to "Disabled" area.

Clear cache. Done.

1
  • Works as expected. Who downvoted for no reason?! Sep 5 '19 at 10:06
-1

To remove the 'Read more' on Drupal 8 click on the following:-

Strucure, Views, Frontpage - edit, change 'Teaser' on dropdown to 'Default'.

Click 'save' = Job done :)

Please note there is no 'Read more module' in Drupal 8 as yet. Drupal 7 has one.

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.