Не могу найти, где изменить мета-описание, ключевые слова и заголовок
Я проверил как конфигурацию области администрирования > дизайн > Заголовок HTML.
Текущее название, описание и ключевые слова в настоящее время взяты не отсюда, хотя в файле бэкенда head.phtml написанный код, я полагаю, заполняет эти поля.
(Я все еще изучаю Magento)
Вот код в предыдущем упомянутом файле
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category design
* @package base_default
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
?>
<meta http-equiv="Content-Type" content="<?php echo $this->getContentType() ?>" />
<title><?php echo $this->getTitle() ?></title>
<meta name="description" content="<?php echo htmlspecialchars($this->getDescription()) ?>" />
<meta name="keywords" content="<?php echo htmlspecialchars($this->getKeywords()) ?>" />
<meta name="robots" content="<?php echo htmlspecialchars($this->getRobots()) ?>" />
<link rel="icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
<link rel="shortcut icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,600,800,700' rel='stylesheet' type='text/css' />
<script src="<?php echo $this->getSkinUrl('js/jquery-1.7.min.js') ?>" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo $this->getSkinUrl('js/scripts.js') ?>"></script>
<script type="text/javascript" src="<?php echo $this->getSkinUrl('js/jquery.prettyPhoto.js') ?>"></script>
<script type="text/javascript" src="<?php echo $this->getSkinUrl('js/jquery.color.js') ?>"></script>
<!--[if lt IE 7]>
<script type="text/javascript">
//<![CDATA[
var BLANK_URL = '<?php echo $this->helper('core/js')->getJsUrl('blank.html') ?>';
var BLANK_IMG = '<?php echo $this->helper('core/js')->getJsUrl('spacer.gif') ?>';
//]]>
</script>
<![endif]-->
<!--[if lt IE 8]>
<div style=' clear: both; text-align:center; position: relative;'>
<a href="http://windows.microsoft.com/en-US/internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode"><img src="http://storage.ie6countdown.com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0" height="42" width="820" alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today." /></a>
</div>
<![endif]-->
<!--[if IE]>
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
<link href='http://fonts.googleapis.com/css?family=Open+Sans:600' rel='stylesheet' type='text/css' />
<link href='http://fonts.googleapis.com/css?family=Open+Sans:700' rel='stylesheet' type='text/css' />
<link href='http://fonts.googleapis.com/css?family=Open+Sans:800' rel='stylesheet' type='text/css' />
<![endif]-->
<?php echo $this->getCssJsHtml() ?>
<?php echo $this->getChildHtml() ?>
<?php echo $this->helper('core/js')->getTranslatorScript() ?>
<?php echo $this->getIncludes() ?>
Я попытался прокомментировать строку 29
<meta name="description" content="<?php echo htmlspecialchars($this->getDescription()) ?>" />
Это приводит к исчезновению мета-описания, поэтому я знаю, что это правильный файл, генерирующий текст, но я не могу понять, где я редактирую поля ввода?
Спасибо за любую помощь.
2 answers
Если есть страница CMS, перейдите на CMS>>Страница>>Добавить/отредактировать вы найдете МЕТА вкладка, на которой вы можете добавить Ключевые слова и Описание . и заголовок появится в форме Информация о странице>>Заголовок страницы.
Если вы загрузите продукт, он будет загружен из каталога >>Управление продуктами>> вы найдете в Метаданные Вкладка в этом.
Magento Загружает эти данные динамически.
Надеюсь, вы получили надлежащее Ответы.
Метаданные отличаются от страницы к странице.
Например, на странице продукта метаданные поступают из Meta title
, Meta description
и Meta keywords
атрибуты продуктов, которые вы просматриваете. То же самое касается категорий и страниц CMS.
Эти значения могут быть установлены из файла макета для любой страницы следующим образом:
<page_handle_here>
<reference name="head">
<action method="setTitle" translate="title"><title>Meta title here</title></action>
<action method="setDescription" translate="description"><description>Meta description here</description></action>
<action method="setKeywords" translate="keywords"><keywords>Meta keywords here</keywords></action>
</reference>
</page_handle_here>
Или из действия контроллера, специфичного для страницы, которую вы просматриваете таким образом после вызова $this->loadLayout()
:
$head = $this->getLayout()->getBlock('head');
if ($head){
$head->setTitle($this->__('Meta title here'));
$head->setDescription($this->__('Meta description here'));
$head->setKeywords($this->__('Meta keywords here'));
}
Если вышеуказанные случаи не относятся к вашей странице затем будут использоваться значения по умолчанию. Значения по умолчанию можно найти в System->Configuration->Design->HTMl Head
. Они называются Default Title
, Default Description
, Default Keywords
.
Эти значения по умолчанию могут отличаться в разных представлениях магазина.