Forum for discussing general topics related to Couch.
27 posts Page 1 of 3
I can see that you have used the 'session/cookie' method of implementing a multi-lingual site.
One drawback of this approach (and this is mentioned in the original thread viewtopic.php?p=9010#p9010) is that there would be only a single URL for all languages.

This can have SEO implications as only the first language pages will get indexed by Google (in your case only the FI pages are getting shown).

I think we'll need to do something about this.
Maybe we should add a parameter in the URLs to explicitly show which language is being shown.


Is there anyone who can help out solving this?
I'm working on new multi-language setup with custom routing/urls. If you have time to experiment and not afraid of docs then use this http://www.couchcms.com/docs/custom-routes/
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
trendoman wrote: I'm working on new multi-language setup with custom routing/urls. If you have time to experiment and not afraid of docs then use this http://www.couchcms.com/docs/custom-routes/



Big thank you to trendoman for helping me fixing these issues on my website, I'm happy with the results so far and looking forward to improve my page even more in order to make it more engaging.

Recently he managed to fix blog issues related to pagination as well as finally giving the site URLS in the other language, I'm very glad that we got this collaboration going and very pleased with his work.
trendoman wrote: I'm working on new multi-language setup with custom routing/urls. If you have time to experiment and not afraid of docs then use this http://www.couchcms.com/docs/custom-routes/


Hi trendoman,

Sorry if I am missing something, I just started with CouchCMS a few days ago ...

I am trying to use routes for setting the language or my blog page based on the URL. But since the URL now doesn't have "p=", couch thinks this is a list view. How should I tell it this is now a page?

I am entirely convinced I got the concept wrong, but here goes anyway:

Code: Select all
        
<cms:route name='lv_table' path='lv' />
<cms:route name='lv_obj' path='{:page_id}/lv' />
<cms:route name='en_table' path='en' />
<cms:route name='en_obj' path='{:page_id}/en' />


The route does match with such URLs:

Code: Select all
/obj.php?q=lv
/obj.php?q=1026/lv


The first one, works fine and shows a list of blog entries.
But when I am trying to show only a certain (blog) page, with the second URL, it doesn't work:

Code: Select all
<cms:if k_matched_route='lv_obj'> 
<cms:dump_all />


shows k_is_list: 1 and of course <cms:show k_page_title /> shows nothing

Any hint on where I am doing it wrong ?
hi,

just a thought

did you try <cms:route name='lv_obj' path='<cms:show k_page_id />/lv' />

Edit:

<cms:set wantedid='10' />

<cms:route name='lv_obj' path='<cms:show wantedid />/lv' />

should work
I load frameworks and write bugs on top of them, after that I rearrange the code so that it looks like a cool product.
No, not working. This is because there is no such thing as k_page_id in "list view"

The question actually is, how can I call a specific blog entry when using routes ?
Hi :)

Page ID is in your URL already and works fine.
After the route is matched you got a new variable rt_page_id.

Hit it with <cms:pages id=rt_page_id > <cms:dump /> </cms:pages>
You'll be able to list the content of your page.

Please let me know how it goes. Custom URL is a very nice way to have M-L setup.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
Now I have this:

Code: Select all
<cms:route name='lv_obj' path="{:page_id}/lv" />


matches fine:

Code: Select all
/obj.php?q=1026/lv


in the code down further I have:

Code: Select all
<cms:pages id=rt_page_id > <cms:dump /> </cms:pages>


I do get the correct content now, but it outputs all of the pages, not just the one I asked for in the URL.

I guess this part doesn't work: <cms:pages id=rt_page_id >
Thanks for update.

Two reasons for it happening. Please, make sure the rt_page_id exists in <cms:dump_all />.
Second, if ID is not found among the pages, then cms:pages ignores it. To avoid such things, we must check for this ID and if it's not found then abort the operations or show something else. It can be done in code with cms:page_exists, but it is nice to use a simple filter in your route definition to cover that.

<cms:route name='lv_obj' path='{:page_id}/lv' filters='page_exists' />


This is how it works. Place a snippet in your /snippets/filters folder page_exists.html.
And place a simple check there, right from the example in docs. Basically, you want this filter to output nothing, if it's okay and page is found and show something (or redirect, or <cms:abort 'wrong page_id' is_404='1' />), if page is not found, effectively stopping further thing.

You also might want to place a check for page_id actually being an integer, to avoid any further checks if page_id fails to be a number.

Code: Select all

<cms:route name='lv_obj' path='{:page_id}/lv'
                                     filters='page_exists' >
              <cms:route_validators page_id='non_zero_integer | non_negative_integer'    />
</cms:route>

Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
Thanks, but turned out to be something else, now I have it working completely :)

Code: Select all
<cms:route name='en_obj' path="{:id}/en" />
<cms:route name='lv_obj' path="{:id}/lv" />
...
<cms:if k_matched_route='lv_obj'>
  <cms:pages id="<cms:show rt_id />">
      <cms:embed 'menu.html' />
  </cms:pages>
<cms:else_if k_matched_route='en_obj' />
(... english values shown here ...)



using URL /obj.php?q=1022/lv shows latvian entry, as it should

The problem was with single quotes around page id. I put double quotes there and now it loads my variables.

Now I guess I need to make nginx rewrite rules for the new URL scheme
27 posts Page 1 of 3