Add a dynamic Login/logout text link on the Dawn theme

Hello,

I would like to add a text link (vs. the theme’s icon) that says LOGIN when a customer is not signed in and says LOGOUT when a customer is signed in.

This will not go in the header where the default icon is. I will put it in another section.

Can you help me with the liquid code to add this to a section of my choice?

TL;DR:

How do I create a dynamic login/logout link that says LOGIN or LOGOUT depending on the viewer’s status that I can use elsewhere in the site besides the Header?

Thank you!

you can start with this code:

{% if customer %}

Logout

{% else %}

Login

{% endif %}
2 Likes

Thank you so much. I can’t believe it was that easy.