Answer the question
In order to leave comments, you need to log in
How to insert a variable into meta tags in Bitrix?
Hello! The crux of the matter is this. There is a meta tag, for example $APPLICATION->SetPageProperty and you need to insert a variable there, i.e. the meta tag changes depending on the parameters. Now I implemented it like this:
$APPLICATION->SetPageProperty("title", "$cur_city[$poddomen]");
$APPLICATION->SetPageProperty("title", "\$cur_city[\$poddomen]");
Answer the question
In order to leave comments, you need to log in
Try like this
$APPLICATION->SetPageProperty("title", $cur_city[$poddomen]);
And those options won't work.
You can try the universal syntax of course, but I don't think it works in this part.
As for the task itself, it is usually done like this:
1) We develop the component, for example, custo:header.meta
2) In the component, we check the conditions (for example, through GetPageProperty ), as well as additional. options.
If in all respects you need to replace - use the design Lorem Ipsum . If you don't need to replace, skip.
Important question: Why do you need to do this?
In Bitrix24 , you cannot deprive the user of the ability to override specific tags on pages.
It's better to do all this in one place than to look for where $cur_city comes from and what $subdomen is.
And besides, it will be necessary to go through each page and see if there are any errors on others, and so - 1 component that holistically closes this task.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question