Results tag, paginate_base, GET variables with multi-language site
Hi
I've got Low Search (3.0.4) set up on a multi-language site (using this multiple index.php method). Recently I needed to change the 'Encode query' setting to 'No' in order to get Google's Sitelinks Search Box working. Search results are working great - but the pagination links when using the 'paginate_base' parameter are only appending the query string for the default English search results.
So in the low_search:results tag, when I have paginate_base set to this:
{language_code_url}/{segment_1}/{segment_2}
({language_code_url} is a global variable set in each language's index.php file)
...English search pagination links work properly, with the keywords query appended to the end:
http://www.domain.com/search/results?...
http://www.domain.com/search/results/...
The German pagination links however don't have the keywords query appended to the end:
http://www.domain.com/de/search/results
http://www.domain.com/de/search/resul...
When I remove the paginate_base parameter, the English pagination links remain the same and work fine. The German links though don't have the {language_code_url} inserted before the first segment so are identical to the English ones - but do have the keywords query appended to the end.
Any ideas as to what I'm doing wrong here? Would updating to the latest version help?
Thanks!
Replies
dan 13 Nov 2014 05:12
I just noticed the 'Open Search URL' link under Settings on the main Low Search page. Maybe this is the answer - point the Google Sitelinks Search Box to:
http://domain.com/?ACT=78&keywords={s...
...and leave the 'Encode query' setting at Yes - I think that could get the pagination working properly again.
The only problem might be the multi language aspect of the site. The ACT URL above would only search for entries in English - it looks like it uses the 'Default result page' from the settings.
Is there any way that setting could be dynamic? So instead of:
search/results
...it would be:
{language_code_url}/search/results
Thanks!
Low 13 Nov 2014 08:50
Upgrading LS to the latest version is always a good idea to try. Does the problem persist with the latest version?
The Open Search URL is meant for APIs more so than using it on your site itself.
dan 13 Nov 2014 16:23
Hi Low - thanks for your response!
I updated the module to 3.3.0 but I'm having the same problems: when I don't use the paginate_base parameter, the pagination links point to the English results page; when I use the paginate_base parameter, they don't have the ?keywords= query appended. There must be something EE doesn't like about my setup when generating those pagination links.
In my second reply, I was thinking that I could use the Open Search URL as the 'target' property in Google's Sitelinks Search Box code. From what I can tell, the 'target' property requires a query string format in order for users to perform a search on my site directly from Google's search results pages.
So my idea was to keep using the default encoded query in the URI for internal site searches (since it was working great with all languages) and only offer the Open Search URL to Google's Sitelinks Search Box - would that work?
The latest Sitelinks Search Box is new so they haven't yet implemented solutions for multi language sites where each homepage resides in a subfolder (/de /fr /es). So for now I think I'll see if this works for the default English language homepage then wait to see how Google deals with other languages.
Thanks for your help!
Low 13 Nov 2014 16:28
> Google's Sitelinks Search Box - would that work?
Yeah, that should work.
As for the pagination links, try changing the hrefs of your pagination links to href="{pagination_url}?{current_query_string}" (see also this thread: http://expressionengine.stackexchange...) to force the presence of the query string.
dan 13 Nov 2014 19:18
Great! I changed the pagination links to force the query string and looks like everything's working in all languages. Thanks for your help!