robbieaverill

you can loop the $Locales and check if the current page exists in each locale with FluentState. that LocaleMenu example just links to each site language, rather than different versions for each page

👍 (2) 😳 (1)
Ramon Lapenta

I didn’t know about FluentState, but the code above does link to each page, so I’m hiding the current page link with CSS and leaving the other one visible, works quite well

👍 (1)
nightjarnz

or even better, a PR that in the very least adds a line about this to the README (if it works) :D

nightjarnz

please feel free to raise an issue about poor docs on this :)

nightjarnz

Will go out on a shot limb here and say that this is it though, perhaps you could reverse ninjaneer if it's not quite what you're after https://github.com/tractorcow-farm/silverstripe-fluent/blob/master/templates/LocaleMenu.ss

Show 1 attachment(s)
templates/LocaleMenu.ss

<% if $Locales %>
<div class="left">Locale <span class="arrow">→</span>
    <nav class="primary">
        <ul>
            <% loop $Locales %>
                <li class="$LinkingMode">
                    <a href="$Link.ATT" <% if $LinkingMode != 'invalid' %>rel="alternate" hreflang="$LocaleRFC1766"<% end_if %>>$Title.XML</a>
                </li>
            <% end_loop %>
        </ul>
    </nav>
</div>
<% end_if %>
Hide attachment content

 

[2019-03-22 08:12:22] manifestcache-log.WARNING: Failed to save values {"keys":["__CACHE__"],"exception":null} []