大网数据广告活动
网站运营与故障问答

SEO for dynamically multilanguage web site

· 52CE 我爱测

I make a web page with dynamically changing language with php. I make html with $lang key <span class="slicice_opis"> <?= $lang['LIJEVO_PRVI_OPIS_PARAGRAF_JEDAN']; ?> <?= $lang['LIJEVO_PRVI_OPIS_PARAGRAF_DVA']; ?> <?= $lang['LIJE…

问题原文

原帖链接 · Arter · CC BY-SA 3.0

I make a web page with dynamically changing language with php. I make html with $lang key

<span class="slicice_opis">
  <?= $lang['LIJEVO_PRVI_OPIS_PARAGRAF_JEDAN']; ?>
  <?= $lang['LIJEVO_PRVI_OPIS_PARAGRAF_DVA']; ?>
  <?= $lang['LIJEVO_PRVI_OPIS_PARAGRAF_TRI']; ?>
 </span>

and I call translate from php file depending on clicked language in dropdown on web page

<?php
/* eng.php */
$lang = array(

'LIJEVO_PRVI_OPIS_PARAGRAF_JEDAN' => 'Test Test',
'LIJEVO_PRVI_OPIS_PARAGRAF_DVA' => 'Test Test',
'LIJEVO_PRVI_OPIS_PARAGRAF_TRI' => 'Test Test',
);

?>

<?php
/* it.php */
$lang = array(

'LIJEVO_PRVI_OPIS_PARAGRAF_JEDAN' => 'Test Test',
'LIJEVO_PRVI_OPIS_PARAGRAF_DVA' => 'Test Test',
'LIJEVO_PRVI_OPIS_PARAGRAF_TRI' => 'Test Test',
);

?>

This is dropdown where I click on wanted language and pass parameters to URL And when I change language my url look like this testtest.com?lang=en or testtest.com?lang=fr etc.

<ul>
<li><a href="?lang=en">en</a></li>
<li><a href="?lang=fr">fr</a></li>
<li><a href="?lang=es">es</a></li>
<li><a href="?lang=it">it</a></li>
</ul>

This is working very well, but I need a suggestion for WEB page optimization for SEO in this way, with this way of translate. I dynamically also change and meta keywords and description, <html lang="selectedLang">, and title and alt on img depending on the selected language.

Default language is ENGLISH, and when Google index my page it's in English. How to make and set links for indexing in another language? My dropdown with language for select is in the footer, is this ok or I need to make another link in the header? I don't understand how SEO works in this way of translate web page. Thank you very much

已采纳解答

原帖链接 · Michael d · CC BY-SA 3.0

If you're going to use the "?" parameter on your site, you should probably notify Google as to how to react to these parameters. You can tell Google how to treat your parameters at https://www.google.com/webmasters/tools/crawl-url-parameters?hl=en&siteUrl=

Make sure you are using the hreflang="x" tag if you want to signal to Google what language your page is in. Learn more here: https://support.google.com/webmasters/answer/189077?hl=en

If you want to simplify the process and not have to inform Google about your "?" parameter pages, you can simply change the URL of the page altogether. Google will index both example.com/page/en and example.com/page/es

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2018-02-20)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。