Answers.Body: <p>I believe you'll want something like this...</p>
  
  <pre><code>{% if currentUser %}
      &lt;a href="{{ url('logout') }}"&gt;Logout&lt;/a&gt;
  {% else %}
      &lt;a href="{{ url('login') }}"&gt;Login&lt;/a&gt;
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-20T08:18:45.303Z
Answers.Text: Thank Lindsey D, your method work perfect ! Much Appreciated
Answers.UserDisplayName: William Spark
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-20T05:34:13.080Z
Answers.LastActivityDate: 2016-05-20T05:34:13.080Z
Answers.UserDisplayName: Lindsey D
Body: <p>I am trying to figure out how to check if a visitor is not logged in so that I can show the correct button. E.g</p>
  
  <pre><code>{% if craft.session.isLoggedIn %}
      &lt;a href="{{ logoutUrl }}"&gt;Logout&lt;/a&gt;
  {% else %}
      {% craft.session.isGuest %}
      &lt;a href="{{ logoutUrl }}"&gt;Client/a&gt;
  {% endif %}
  </code></pre>
  
  <p>What is the best method to display a "sign in" button for a visitor that takes them to a login page and then once logged in, show "Logout"?</p>
  
Tags: <templating>
Title: Check if Visitor show logon button
ThreadText: # Check if Visitor show logon button
  
  (Asked by: username_0 on 2016-05-20)
  
  I am trying to figure out how to check if a visitor is not logged in so that I can show the correct button. E.g
  
  ```
  {% if craft.session.isLoggedIn %}
      <a href="{{ logoutUrl }}">Logout</a>
  {% else %}
      {% craft.session.isGuest %}
      <a href="{{ logoutUrl }}">Client/a>
  {% endif %}
  
  ```
  
  What is the best method to display a "sign in" button for a visitor that takes them to a login page and then once logged in, show "Logout"?
  
  **Tags:** templating
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-05-20. Score: 4 | Accepted answer
  
  I believe you'll want something like this...
  
  ```
  {% if currentUser %}
      <a href="{{ url('logout') }}">Logout</a>
  {% else %}
      <a href="{{ url('login') }}">Login</a>
  {% endif %}
  
  ```
  
  > **Comments:**
  > **username_0**: Thank username_1, your method work perfect ! Much Appreciated  
  
  ---
  
  