Who knows how to loop through all sites in multisite installation? I want to create kind of drop down menu to switch between websites. I've found this code inside the backend template but looks like it doesn't works in frontend
{% for site in allSites %}
<tr data-id="{{ site.id }}" data-name="{{ site.name|t('site') }}">
<th scope="row" data-title="{{ 'Name'|t('app') }}"><a href="{{ url('settings/sites/' ~ site.id) }}">{{ site.name|t('site') }}</a></th>
<td data-title="{{ 'Handle'|t('app') }}"><code>{{ site.handle }}</code></td>
<td data-title="{{ 'Language'|t('app') }}"><code>{{ site.language }}</code></td>
<td data-title="{{ 'Base URL'|t('app') }}"><code>{{ site.baseUrl }}</code></td>
{% if multiple %}
<td class="thin"><a class="move icon" title="{{ 'Reorder'|t('app') }}" role="button"></a></td>
<td class="thin"><a class="delete icon" title="{{ 'Delete'|t('app') }}" role="button"></a></td>
{% endif %}
</tr>
{% endfor %}
UPD: Now I can fetch names of websites by their Ids:
{% set allSitesIds = craft.app.sites.getAllSiteIds() %}
{% for site in allSitesIds %}
{% set siteName = craft.app.sites.getSiteById(site) %}
{{siteName}}
{% endfor %}