Limit Change to Read More Link in Node Teaser to One Content Type Building on this answer:

/**
 * Implements hook_preprocess_links().
 */
function bartik_preprocess_links(&amp;$variables) {
    if (isset($variables['links']['node-readmore'])) {
      $variables['links']['node-readmore']['link']['#title'] = t('Read more custom text');
    }
}


does anyone know how to build the if statement to further limit the change in the read more link to a particular content type? I'm working in Drupal 8, not 7.
Add following to your THEMENAME.theme file

/**
 * Implements hook_preprocess_HOOK() for node.html.twig.
 */
function THEMENAME_preprocess_node(&amp;$variables) {
    // ...
    if ($variables['teaser']) {
    $node_type = &amp;drupal_static('node_type');
    $node_type = $variables['node']-&gt;getType();
  }
}


/**
 * Implements hook_preprocess_links().
 */
function THEMENAME_preprocess_links(&amp;$variables) {
  $node_type = &amp;drupal_static('node_type');
    if (isset($variables['links']['node-readmore'])) {
        // Change link title according to machine name of node_type
        if ($node_type == 'article') {
            $variables['links']['node-readmore']['link']['#title'] = t('Custom Text');
        }
    } 
}


Clear Cache.