Edit "Read more" and "Add new comment" links in teaser
You can do this in a couple of different ways. By looking up the Drupal\node\NodeViewBuilder::renderLinks method, you can see how it works.

1. Implement hook_node_links_alter()

This should work for a module.

function mymodule_node_links_alter(array &amp;$links, NodeInterface $entity, array &amp;$context) {
  $links['node']['#links']['node-readmore']['#attributes']['class'][] = 'btn btn-primary';
}


2. Implement template_preprocess_links()

And I think this should work for the theme...

function mytheme_preprocess_links(&amp;$variables) {
  // some logic enclosing this block
  $variables['node']['#links']['node-readmore']['#attributes']['class'][] = 'btn btn-primary';
}