diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php
index 776c535d586..cdad3fcced6 100644
--- a/htdocs/core/lib/website2.lib.php
+++ b/htdocs/core/lib/website2.lib.php
@@ -157,9 +157,14 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
$tplcontent .= ''."\n";
$tplcontent .= ''."\n";
$tplcontent .= ''."\n";
+ // Add canonical reference
+ if ($object->virtualhost) {
+ $tplcontent .= ''."\n";
+ }
// Add translation reference (main language)
if ($object->isMultiLang()) {
// Add myself
+ $tplcontent .= 'pageurl.'.php") { ?>'."\n";
$tplcontent .= ''."\n";
// Add page "translation of"
@@ -194,10 +199,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
}
}
else dol_print_error($db);
- }
- // Add canonical reference
- if ($object->virtualhost) {
- $tplcontent .= ''."\n";
+ $tplcontent .= ''."\n";
}
// Add manifest.json on homepage
$tplcontent .= 'use_manifest) { print \'\'."\n"; } ?>'."\n";