# Custom Header Links

**URL:** https://meta.discourse.org/t/custom-header-links/90588
**Category:** Theme component
**Tags:** official, custom-header-links
**Created:** [June 24, 2018, 10:22am UTC](https://meta.discourse.org/t/custom-header-links/90588 "2018-06-24T10:22:32Z")
**Posts on this page:** 1
**Showing post:** 137

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [January 30, 2022, 9:29am UTC](https://meta.discourse.org/t/custom-header-links/90588/137 "2022-01-30T09:29:49Z")

</div>

Hey @andreas_can welcome to Meta 👋

This component adds a CSS class to each link based on its text. The class added is the same as the text you give the link except that spaces are replaced with a hyphen (`-`) and the text is set to lowercase. Then the string `-custom-header-links` is appended at the end.

So if you add a link with the text

`privacy`

then the link element will have the class

`privacy-custom-header-links`

If your link text is

`Visit Shop`

then the CSS class would be

`visit-shop-custom-header-links`

So, now you know the class added to each link. Going back to your question.

> [@andreas\_can](#):
>
> Is it possible to have a link only be visible if the user is logged in?

Discourse adds a CSS class to the `<HTML>` tag when the user is not logged in. That class is

`anon`

So, you can use that to hide certain links for users who are not logged in. Let’s say I have a link with the text

`Customer Support`

and I don’t want it to show to users who are not logged in.

I would then add this CSS

```scss
.anon {
  .customer-support-custom-header-links {
    display: none;
  }
}

```

in the `common > CSS` tab of my main theme.

This will hide that particular link for users who are not logged in.

---

_[View the full topic](https://meta.discourse.org/t/custom-header-links/90588)._
