Change record status: 
Project: 
Introduced in branch: 
8.0.x
Introduced in version: 
8.0.0-beta4
Description: 

To display a link with only a #fragment, the special route can be used.

Drupal 7

$fragment_only_url = url('', array('external' => TRUE, 'fragment' => 'fragment'));

Drupal 8

$fragment_only_url = \Drupal::url('<none>', [], ['fragment' => 'fragment']);
Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done