Check if it's the front page in the template
The variable you're looking for is called is_front:

{% if is_front %}


The available variables for a template are documented at the top of the .html.twig file, however there is also a set of default variables available to all templates (which are not documented in every single template). You can find them in _template_preprocess_default_variables().