首页 > 解决方案 > 自动生成 Hreflangs

问题描述

我想请人帮忙创建一个代码,在网页上自动生成具有相同名称的hreflangs (例如/page123.php)。

例如页面www.example.it/page123.php有许多其他语言的版本。

是否可以根据链接自动生成代码?

例如:

<link rel="canonical" href="https://www.example.it/page123.php" />
<link rel="alternate" href="https://www.example.it/de/page123.php" hreflang="de" />
<link rel="alternate" href="https://www.example.it/en/page123.php" hreflang="en" />

ETC..

document.getElementById("url").innerHTML = window.location.href;
<p id="url"></p>

标签: javascriptphphtmlautomationhreflang

解决方案


推荐阅读