Show  on user page if user page belongs to current user I have made a page that displays information about a user, much like a profile page. 

Now I want users to be able to edit their information, so I added a button using twig tweak in user.html.twig: 

{% if logged_in %}
&lt;div class = "row"&gt; 
    &lt;a href ="{{ drupal_token('current-user:edit-url') }}" class = "edit-profile-btn col-lg-12"&gt;
      &lt;div&gt;Edit profile&lt;/div&gt;
    &lt;/a&gt; 
&lt;/div&gt;
{% endif %}




This works fine, however the button is displayed on every profile page. I want to hide the button if a user is viewing another user's page. 


  Can this be done using an {{ if statement }} to check if the viewed page belongs to the logged in user?
To do this right you will need to use this combination of tests.

Is the user logged in {% if logged_in %} ?

Does the user have the permission needed to edit their profile with {% if user.hasPermission('depends on your site setup') %}?

Is the owner of the node the same as the current user?  {% if node.ownerId  == user.id %}

NOTE: The snippets above are not tested.  You may have to tweak to get the correct info (e.g. getOwnerId SHOULD equal node.ownerId.. but twig may have a different opinion).