<p>You're close, <code>craft.app.sites</code> in Twig gives you access to the <a href="https://docs.craftcms.com/api/v4/craft-services-sites.html" rel="nofollow noreferrer">service <code>craft\services\Sites</code></a>, which can be used to access specific sites. For example:</p>
<pre class="lang-twig prettyprint-override"><code>{# Get the primary site #}
{% set primarySite = craft.app.sites.getPrimarySite() %}

{# Get a specific site by handle #}
{% set myAwesomeSite = craft.app.sites.getSiteByHandle('myAwesomeSite') %}

{# Get an array with all sites #}
{% set allSites = craft.app.sites.getAllSites() %}
</code></pre>
<p>Use the <a href="https://docs.craftcms.com/api/v4/craft-services-sites.html#public-methods" rel="nofollow noreferrer">class reference</a> to find out what methods are available on the service.</p>
<hr />
<blockquote>
<p>I couldn't find a way, maybe it's close to craft.app.sites but don't know how to do it, of course sites have his own handle. Thank you.</p>
</blockquote>
<p>A useful tip is to use the <code>{% dd %}</code> tag to find out what a variable contains:</p>
<pre class="lang-twig prettyprint-override"><code>{% dd craft.app.sites %}
</code></pre>
<p>Put this anywhere in your Twig template and it will tell you which class the variable is an instance of. Then you can look that up in the class reference and take it from there.</p>

CC BY-SA 4.0
2022-07-29T12:56:21.417Z
Amazing! Great explanation, thank you Moritz!
Sebastian
CC BY-SA 4.0
2022-07-29T13:16:07.230Z
@Sebastian Glad I could help! If your issue is solved, would you mind marking my answer as accepted? Thanks.
MoritzLost
CC BY-SA 4.0
2022-07-29T08:46:21.347Z
2022-07-29T13:16:39.700Z
2022-07-29T13:16:39.700Z
MoritzLost
<p>I'm working on a multisite installation on Craft, and i want to know if it's possible to select a specific site to show for example a link to it, sitename and other attributes.</p>
<p>I couldn't find a way, maybe it's close to craft.app.sites but don't know how to do it, of course sites have his own handle. Thank you.</p>

<craft3>
Is possible to select a site in a multisite installation to show his url, sitename, and more properties? (Craft 3)
# Is possible to select a site in a multisite installation to show his url, sitename, and more properties? (Craft 3)

(Asked by: username_0 on 2022-07-28)

I'm working on a multisite installation on Craft, and i want to know if it's possible to select a specific site to show for example a link to it, sitename and other attributes.

I couldn't find a way, maybe it's close to craft.app.sites but don't know how to do it, of course sites have his own handle. Thank you.

**Tags:** craft3


---

## 1 answers

### Answer by username_1 on 2022-07-29. Score: 0 | Accepted answer

You're close, craft.app.sites in Twig gives you access to the service craft\services\Sites, which can be used to access specific sites. For example:
{# Get the primary site #}
{% set primarySite = craft.app.sites.getPrimarySite() %}

{# Get a specific site by handle #}
{% set myAwesomeSite = craft.app.sites.getSiteByHandle('myAwesomeSite') %}

{# Get an array with all sites #}
{% set allSites = craft.app.sites.getAllSites() %}

Use the class reference to find out what methods are available on the service.


I couldn't find a way, maybe it's close to craft.app.sites but don't know how to do it, of course sites have his own handle. Thank you.

A useful tip is to use the {% dd %} tag to find out what a variable contains:
{% dd craft.app.sites %}

Put this anywhere in your Twig template and it will tell you which class the variable is an instance of. Then you can look that up in the class reference and take it from there.

> **Comments:**
> **username_0**: Amazing! Great explanation, thank you Moritz!  
> **username_1**: @username_0 Glad I could help! If your issue is solved, would you mind marking my answer as accepted? Thanks.  

---

