Can you get the baseUrl for site by handle or id? 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:

&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;


What I'm trying to avoid doing is:

&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;


Or is that just how to you do?
{% 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 since you "answered" that question