How to alter Read more link for a node

Components

If you want to alter the title of the Read more link or perhaps add some CSS classes, you can do that by using the hook_node_links_alter() hook.

use Drupal\node\NodeInterface;

function MY_MODULE_node_links_alter(array &$links, NodeInterface $entity, array &$context) {
  if (!empty($links['node']['#links']['node-readmore']['title'])) {
    $links['node']['#links']['node-readmore']['title'] = t('View Details');
    $links['node']['#links']['node-readmore']['attributes']['class'][] = 'view-details-link';
  }
}

You can do this just for some content types, by checking the bundle value: if ($entity->bundle() == 'article') {}