P
P
pasib2017-06-21 09:13:37
1C-Bitrix
pasib, 2017-06-21 09:13:37

How to set up a catalog template so that section pages are filled with meta tags from the fields of the SEO tab?

The site is powered by Bitrix.
For site pages with sections with a list of elements (products) and for the elements (products) themselves, meta tags are filled in correctly from the fields of the SEO tab.
On the site, for pages of top-level sections (with a list of subsections) of the catalog component, meta tags are filled out not from the fields of the SEO tab. For such sections, meta tags are taken from the section titles. How to fix this issue.
Probably, something is written incorrectly in the bitrix:catalog.section.list section list template?
If we replace the catalog component template with another one instead of the default one, then the meta tags of such sections will be filled in from the fields of the SEO tab. However, I can’t use another template, because the output of sections, elements and their formatting on the page is violated.
Below is the bitrix template code:catalog.section.list
++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++ ++
<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?><?if (!empty($arResult["SECTION_USER_FIELDS"]["UF_BROWSER_TITLE"]))
$APPLICATION ->SetTitle($arResult["SECTION"]["SECTION_USER_FIELDS"]["UF_BROWSER_TITLE"]);
else
$APPLICATION->SetTitle($arResult["SECTION"]["NAME"]);
if (!empty($arResult["SECTION_USER_FIELDS"]["UF_TITLE_H1"]))
$APPLICATION->SetPageProperty("ADDITIONAL_TITLE", $arResult["SECTION"]["SECTION_USER_FIELDS"]["UF_TITLE_H1"]);
$APPLICATION->SetPageProperty("title", $arResult["SECTION"]["NAME"]);
$APPLICATION->SetPageProperty("description", $arResult["SECTION"]["NAME"]);
$APPLICATION->SetPageProperty("keywords", $arResult["SECTION"]["NAME"]);
$TOP_DEPTH = $arResult["SECTION"]["DEPTH_LEVEL"];
$CURRENT_DEPTH = $TOP_DEPTH;
?>
<? if (!empty($arResult["SECTIONS"])): ?>


<? if (($arSection["ELEMENT_CNT"] > 0) || !empty($arSection["DESCRIPTION"])): ?> " href="<?=$arSection["SECTION_PAGE_URL"]?>"><? en... <?endif;?>
  
<? endif; ?>
<?=$arResult["SECTION"]["DESCRIPTION"]; ?>
++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Emelyanov, 2017-06-21
@babarun

Show bitrix:catalog component settings

P
pasib, 2017-06-22
@pasib

Parameters of the bitrix:catalog component
If you comment out part of the code, an error occurs
/* <?if (!empty($arResult["SECTION_USER_FIELDS"]["UF_BROWSER_TITLE"]))
$APPLICATION->SetTitle($arResult["SECTION"]["SECTION_USER_FIELDS "]["UF_BROWSER_TITLE"]);
else
$APPLICATION->SetTitle($arResult["SECTION"]["NAME"]);
if (!empty($arResult["SECTION_USER_FIELDS"]["UF_TITLE_H1"]))
$APPLICATION->SetPageProperty("ADDITIONAL_TITLE", $arResult["SECTION"]["SECTION_USER_FIELDS"]["UF_TITLE_H1"]);
else
$APPLICATION->SetPageProperty("ADDITIONAL_TITLE", $arResult["SECTION"]["NAME"]);?>
<?
$APPLICATION->SetPageProperty("title", $arResult["SECTION"]["NAME"]);
$APPLICATION->SetPageProperty("description", $arResult["SECTION"]["NAME"]);
$APPLICATION->SetPageProperty("keywords", $arResult["SECTION"]["NAME"]);
*/

R
Roman Gritsuk, 2017-06-25
@winer

So you have meta tags set in the template code -

<?
$APPLICATION->SetTitle($arResult["SECTION"]["SECTION_USER_FIELDS"]["UF_BROWSER_TITLE"]);
else
$APPLICATION->SetTitle($arResult["SECTION"]["NAME"]);

if (!empty($arResult["SECTION_USER_FIELDS"]["UF_TITLE_H1"]))
$APPLICATION->SetPageProperty("ADDITIONAL_TITLE", $arResult["SECTION"]["SECTION_USER_FIELDS"]["UF_TITLE_H1"]);
else
$APPLICATION->SetPageProperty("ADDITIONAL_TITLE", $arResult["SECTION"]["NAME"]);?>
<?

$APPLICATION->SetPageProperty("title", $arResult["SECTION"]["NAME"]);
$APPLICATION->SetPageProperty("description", $arResult["SECTION"]["NAME"]);
$APPLICATION->SetPageProperty("keywords", $arResult["SECTION"]["NAME"]);

Delete or comment out these lines. You may still need to change a few settings in the component.
Even if you still want to leave them for some purpose, then this code will not work with caching enabled. These are all deferred functions and should be moved to component_epilog.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question