How can I create a Link to an URL containing a fragment identifier?
Please see public static function Link::createFromRoute


array $options: The options parameter takes exactly the same structure. See \Drupal\Core\Url::fromUri() for details.

You can pass a 4th argument as an array with a fragment key value:
Link::createFromRoute($this-&gt;t('Title'), 'entity.node.canonical', ['node' =&gt; 77], ['fragment' =&gt; 'example']);