SEO same content in 2 countries, how to implement hreflang?

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
macangelo
Posts: 756
Joined: Sat 29. Nov 2003, 14:19
Location: Düsseldorf
Contact:

SEO same content in 2 countries, how to implement hreflang?

Post by macangelo »

Hi,

I have almost the same text on two websites: mydomain.de and mydomain.ch. Both sites are in German language, one for Germany, one for Switzerland. The SEO advisor says that I need for example the following in the header to prevent Google for punishing me for double content:

<link rel="alternate" href="http://mydomain.ch/ch-subject.html" hreflang="de-CH" />
<link rel="alternate" href="http://mydomain.de/de-subject.html" hreflang="de-DE" />

Now, the "ch-subject.html"-part of the URL is generated per url-rewrite in the .htaccess file.
And the url-rewrite script of cause uses the alias of the article - let's say "ch-subject".

What do I put in my header (usually in the template) to generate these tags for each articles? Or how do I do that?

Thanks a lot
Webdesign from Düsseldorf - made with phpwcms (most of it):
http://eyelikeit.com/index.php?de_beispiele-webdesign
Old Boy
Posts: 1203
Joined: Fri 23. Nov 2012, 13:52

Re: SEO same content in 2 countries, how to implement hrefla

Post by Old Boy »

Isn't it possible, to use 2 separate main templates for the different "languages"???
macangelo
Posts: 756
Joined: Sat 29. Nov 2003, 14:19
Location: Düsseldorf
Contact:

Re: SEO same content in 2 countries, how to implement hrefla

Post by macangelo »

It is. These are even 2 separate phpwcms installations running under different IPs.

Still - maybe I have a little block in my brain ;-) - but how do I get the specific link tags with the specific url in each and every article's head?
Webdesign from Düsseldorf - made with phpwcms (most of it):
http://eyelikeit.com/index.php?de_beispiele-webdesign
User avatar
Oliver Georgi
Site Admin
Posts: 9888
Joined: Fri 3. Oct 2003, 22:22
Contact:

Re: SEO same content in 2 countries, how to implement hrefla

Post by Oliver Georgi »

no need to have different templates, first I would configure the lang config for your needs. Then you have the correct lang attribute in the <html> tag.

The <link> can be generated using frontend render. If it's done well it's also not that hard to switch the domain too based on detected language and keep everything on the same hosting account inside the same CMS installation.

There is more https://support.google.com/webmasters/topic/2370587
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
Post Reply