Answers.Body: <pre><code>{% set site = craft.app.getSites().getSiteById(1) %}
  {% set site = craft.app.getSites().getSiteByHandle('handle') %}
  {{ site.baseUrl }}
  </code></pre>
  
  <p>But I would rather suggest you to grab the entries URL for a certain site in your language switcher</p>
  
  <pre><code>{% set entryInOtherSite = craft.entries.id(entry.id).siteId(2).one() %}
  {{ entry.getUrl() }}
  </code></pre>
  
  <p>I'm not sure why you even ask this question since everything is well documented <a href="https://craftcms.stackexchange.com/questions/23710/craft-3-language-switcher">here</a> since you "answered" that question</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-02T13:10:15.570Z
Answers.Text: What I was trying to do here is different than my previous post. Thanks for the help.
Answers.UserDisplayName: Danielle Frappier
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-29T18:40:24.573Z
Answers.LastActivityDate: 2018-06-29T18:40:24.573Z
Answers.UserDisplayName: Robin Schambach
Body: <p>I am making a super simple language switcher. And I was wondering if there is a way to get the baseUrl for a site by id or handle, something like this:</p>
  
  <pre><code>&lt;a class="navbar-item" href="{{baseUrl.german}}"&gt;&lt;img class="circular-square" src="/images/global/german.png" alt="Germany Flag" /&gt;DE&lt;span class="sr-only"&gt;Deutsch&lt;/span&gt;&lt;/a&gt;
  </code></pre>
  
  <p>What I'm trying to avoid doing is:</p>
  
  <pre><code>&lt;a class="navbar-item" href="/de"&gt;&lt;img class="circular-square" src="/images/global/german.png" alt="Germany Flag" /&gt;DE&lt;span class="sr-only"&gt;Deutsch&lt;/span&gt;&lt;/a&gt;
  </code></pre>
  
  <p>Or is that just how to you do? </p>
  
Tags: <multi-site>
Title: Can you get the baseUrl for site by handle or id?
ThreadText: # Can you get the baseUrl for site by handle or id?
  
  (Asked by: username_0 on 2018-06-29)
  
  I am making a super simple language switcher. And I was wondering if there is a way to get the baseUrl for a site by id or handle, something like this:
  
  ```
  <a class="navbar-item" href="{{baseUrl.german}}"><img class="circular-square" src="/images/global/german.png" alt="Germany Flag" />DE<span class="sr-only">Deutsch</span></a>
  
  ```
  
  What I'm trying to avoid doing is:
  
  ```
  <a class="navbar-item" href="/de"><img class="circular-square" src="/images/global/german.png" alt="Germany Flag" />DE<span class="sr-only">Deutsch</span></a>
  
  ```
  
  Or is that just how to you do?
  
  **Tags:** multi-site
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-06-29. Score: 5 | Accepted answer
  
  ```
  {% set site = craft.app.getSites().getSiteById(1) %}
  {% set site = craft.app.getSites().getSiteByHandle('handle') %}
  {{ site.baseUrl }}
  
  ```
  
  But I would rather suggest you to grab the entries URL for a certain site in your language switcher
  
  ```
  {% set entryInOtherSite = craft.entries.id(entry.id).siteId(2).one() %}
  {{ entry.getUrl() }}
  
  ```
  
  I'm not sure why you even ask this question since everything is well documented [here](https://craftcms.stackexchange.com/questions/23710/craft-3-language-switcher) since you "answered" that question
  
  > **Comments:**
  > **username_0**: What I was trying to do here is different than my previous post. Thanks for the help.  
  
  ---
  
  