Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Use this page as the 'home page' for the following domains


Go to End
Reply


9 Posts   2254 Views

Avatar
snaip

Community Member, 180 Posts

22 October 2009 at 12:05am

hi

i have multilanguage page
i want that the german version has different domain from the english

i enter german domain to the german varsion HomePage into "Use this page as the 'home page' for the following domains:" field but it doesnt work
should i have redirect domain DNS to my server ? or redirect to the german home page addres: www.mysite.com/de-home-page ?

Avatar
Cristian

Community Member, 8 Posts

26 March 2010 at 4:50am

Hi,

Did you figure out what to do, I'm having the exact same problem.

the HomepageForDomain only work with the default Locale... not the translated one.

thanks,
Cristian

Avatar
snaip

Community Member, 180 Posts

10 May 2010 at 7:19am

hi

no i didn't
it is so stupid that it doesnt work with translate

Avatar
Futureal

Community Member, 9 Posts

2 June 2011 at 9:34pm

does anyone know if this is solved yet?
I want to set a different homepage for the non-default locale?

Thanks.

Avatar
Chris_Bryer

Community Member, 35 Posts

8 June 2011 at 3:22pm

Edited: 08/06/2011 3:26pm

hey everyone,
we have been discussing this on the core dev discussion group. currently translatable is part of the core code but ingo pulled translatable out of sapphire and cms for future versions of silverstripe so its more easy to update and fix without hacking core code.

I built a little module that should do what you need, located at [url]https://github.com/cbryer/Translatable-Domains[/url]. it needs some testing and a little more work done on it, but its working pretty well for me. this code lets you register top level domains with specific locales, and the module makes sure that you view for example, a german page while on a german TLD. just point all the domains at the same silverstripe directory so they see the same thing and the module handles the rest.

i also included directions on how to set up different localhosts to simulate different tld's so you can test locally.

also, this could easily be re-written to support subdomains instead of top level domains. the idea is that when this is stable, it will be merged with the new translatable module and this functionality will be built in.

let me know how it goes, any questions, feedback, etc.
-Chris

Avatar
jpmcc

Community Member, 14 Posts

15 February 2012 at 10:19pm

Hi Chris,

This looks great and exactly what I need. Just found a slight issue though (and I know this is still work in progress), but if you try and access a page that is not in the current locale, rather than a 404, the system tries to send you to /<page_name> without any domain part (which for some browsers either sends you to Google or gives a browser generated 404.

Any ideas?

Thanks for the work on this.

Jason.

Avatar
jpmcc

Community Member, 14 Posts

16 February 2012 at 3:21am

Hi,

Turns out to be my fault for not specifying the default domain for the default locale. Doing that and it does exactly what it is supposed to.

Cheers,
Jason.

Avatar
jpmcc

Community Member, 14 Posts

22 February 2012 at 9:48pm

Edited: 22/02/2012 9:49pm

Just a quick update.

Something to be aware of. When using Translatable, it automatically inserts alternate meta tags (when your meta tags are generated automatically), to point to any additional live translations of a specific page. However, it doesn't include the domain portion. Therefore whatever follows the link will be taken back to the current version of the page and not the alternative one.

This is because the current domain is obviously assumed, and with the SingleLocalDomain in place, it is detected that the alternate page should not be displayed for the current domain so back to the original page.

Just as a work around, I have overridden the MetaTags function for my base page object, filter out the <link rel="alternate" ... /> tags and inserted my own. The code used to generate them is essentially the same as the code used by Translatable, however, I grab the list of available domains from TranslatableDomain and use that to help construct the links.

public function MetaTags($includeTitle = true){
   //remove the alternate meta and insert our own version
   $meta = preg_replace('/<link\srel="alternate".*\s\/>/i', '', parent::MetaTags($includeTitle));
   $meta .= $this->alternateMeta();
   return $meta;
}

The alternateMeta function just ensures the domain portions are added.

I know you could reduce that to one line, but sometimes having an intermediate var helps the debugging process and makes it a little more legible.

Cheers,
Jason.

Go to Top