Commit 1326d6ca authored by Goutte's avatar Goutte

Fix the polyglot link in the language selector.

parent 26734325
...@@ -198,11 +198,13 @@ class M3P2Plugin extends Plugin ...@@ -198,11 +198,13 @@ class M3P2Plugin extends Plugin
$pages = $this->grav['pages']; $pages = $this->grav['pages'];
$that_page_route = "/" . join("/", array_slice($uri->paths(), 1)); $that_page_route = "/" . join("/", array_slice($uri->paths(), 1));
// var_dump($that_page_route); // var_dump($that_page_route);
$target_page = $pages->find($that_page_route); $target_page = $pages->find($that_page_route, true);
if ( ! $target_page) { if ( ! $target_page) {
var_dump("NOT FOUND");
return; return;
} }
......
...@@ -55,7 +55,9 @@ ...@@ -55,7 +55,9 @@
{% block polyglot_language_selector %} {% block polyglot_language_selector %}
{% if uri.paths and not disable_multilingual %} {% if uri.paths and not disable_multilingual %}
<li> <li>
<a href="{{ '/polyglot-columns' ~ uri.path }}"> {# Ideally we'd give the localized slug, but I can't ->find() it afterwards #}
{# <a href="{{ '/polyglot-columns' ~ uri.path }}">#}
<a href="{{ '/polyglot-columns' ~ page.rawRoute }}">
{% if language_display.select == 'default' or language_display.select == 'flag' %} {% if language_display.select == 'default' or language_display.select == 'flag' %}
<img alt="Rosetta" src="/{{ grav.locator.findResource('plugin://m3-p2/flags/xx.png', false) }}" /> <img alt="Rosetta" src="/{{ grav.locator.findResource('plugin://m3-p2/flags/xx.png', false) }}" />
{% endif %} {% endif %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment