How to display the views page title in a custom fieldable block Goal:
To create a custom fieldable block as available out of the box in D8, which also shows the page title of a a views page, if the page it is displayed on is a views page.

I created a custom block type, and added an image field for the block background.

I then copied and modified the block template to include:

{% if title %}
  &lt;h1&gt;{{ title }}&lt;/h1&gt;
{% endif %}


But the views title does not show up. The page source shows nothing rendered. I enable theme debugging and the new block template is being used.
Views sets the title configured in a Views page statically in the route definition. Get this title from the current route in a preprocess hook for your specific block content UUID. Add a routecache context, so that the block changes the title when you visit different pages:

function mytheme_preprocess_block(&amp;$variables) {
  if ($variables['plugin_id'] == 'block_content:12345678-1234-5678-90ab-1234567890ab') {
    $variables['title'] = \Drupal::routeMatch()-&gt;getRouteObject()-&gt;getDefault('_title');
    $variables['#cache']['contexts'][] = 'route';
  }
}