Answer the question
In order to leave comments, you need to log in
How to change meta tags when multisite?
Hello. Does anyone know how to correctly implement the following functionality.
I have a domain and 2 subdomains.
Domain: test.ru
Subdomains: phone.test.ru and phone2.test.ru
Subdomains are made just like aliases.
I need to be able to change Meta tags when editing a regular text page from the public part.
<?
if($_SERVER["HTTP_HOST"] == "phone.test.ru"){
$APPLICATION->SetPageProperty("description", "Контакты Один");;
$APPLICATION->SetTitle("Контакты Один");
}elseif($_SERVER["HTTP_HOST"] == "phone2.test.ru"){
$APPLICATION->SetPageProperty("description", "Контакты 2");
$APPLICATION->SetTitle("Контакты 2");
}else{
$APPLICATION->SetPageProperty("description", "Другие контакты");
$APPLICATION->SetTitle("Другие контакты");
};
?>
Answer the question
In order to leave comments, you need to log in
you can make a wrapper component that will have to be placed on all pages.
the component parameters will be the values of the meta tags to be set.
in this case, all the logic for setting meta tags will be encapsulated in the component.
it is also possible to break such code if you remove the component - but this can only be avoided by prohibiting editing files from the public part at all
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question