Перейти до вмісту
Пошук в
  • Детальніше...
Шукати результати, які ...
Шукати результати в ...

Google Sitemap трижды дублирует ссылки


vazel48

Recommended Posts

Помогите пожалуйста! Так как решения не нашел, решил создать тему. 

OcStore 1.5.5.1.1, стандартный Seo Pro работает, ссылки на сайте не дублируются, но Google Sitemap генерирует по 3 одинаковых ссылки на товар.

Может неправильно настроены файлы robots.txt или .htaccess

Помогите пожалуйста настроить файлы. 

 

Путь к файлам:

shoppa.com.ua/robots.txt

shoppa.com.ua/index.php?route=feed/google_sitemap

 

в файле .htaccess написано: 

RewriteBase /

RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
Надіслати
Поділитися на інших сайтах


Короче забил на встроенный Гугл Сайтмап, поставил Динамический Google XML Sitemap <vQmod>, но там тоже не все гладко...

Посмотрите плз на правильность оформления файла robots.txt и  .htaccess

Надіслати
Поділитися на інших сайтах


  • 2 weeks later...
У меня видимо похожая проблема. Но без ЧПУ.  

Стоит ocStore 1.5.5.1.1 

Google Sitemap генерирует дубли страниц вида index.php?route=product/product*&manufacturer_id=

которые  запрещены  в robots.txt

в каком месте можно настроить правило вывода для  Google Sitemap? 

Надіслати
Поділитися на інших сайтах


 

У меня видимо похожая проблема. Но без ЧПУ.  
Стоит ocStore 1.5.5.1.1 
Google Sitemap генерирует дубли страниц вида index.php?route=product/product*&manufacturer_id=
которые  запрещены  в robots.txt
в каком месте можно настроить правило вывода для  Google Sitemap? 

 

 

Такая же проблема.

Надіслати
Поділитися на інших сайтах


  • 2 months later...
  • 6 months later...
  • 3 weeks later...

Путем долгих экспериментов удалось настроить sitemap.xml без дублирования ссылок для ocStore 1.5.5.1.2 со включенным seoPro.

 

Повтор (иногда больше 3 раз) происходит потому, что ссылки вида site/product, site/catalog/product, site/catalog/podcatalog/product и ссылки site/manufacturers/product ведут на один адрес - site/catalog/product.

 

Чтобы избавиться от дублей нужно в файле /catalog/controller/feed/google_sitemap.php добавить "//" для следующего кода:

 

$products = $this->model_catalog_product->getProducts(array('filter_manufacturer_id' => $manufacturer['manufacturer_id']));
			
//foreach ($products as $product) {
//   $output .= '<url>';
//   $output .= '<loc>' . $this->url->link('product/product', 'manufacturer_id=' . $manufacturer['manufacturer_id'] . '&product_id=' . $product['product_id']) . '</loc>';
//   $output .= '<changefreq>weekly</changefreq>';
//   $output .= '<priority>1.0</priority>';
//   $output .= '</url>';   
//} 
$products = $this->model_catalog_product->getProducts(array('filter_category_id' => $result['category_id']));
 
// foreach ($products as $product) {
// $output .= '<url>';
// $output .= '<loc>' . $this->url->link('product/product', 'path=' . $new_path . '&product_id=' . $product['product_id']) . '</loc>';
// $output .= '<changefreq>weekly</changefreq>';
// $output .= '<priority>1.0</priority>';
// $output .= '</url>';   
//} 
После этого в sitemap.xml буду попадать ссылки всех товаров без дублей.

 

Еще немного полезного:

 

1. Ссылка на главную страницу и любую свою страницу (например site/news)

$output  = '<?xml version="1.0" encoding="UTF-8"?>';
$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';

$output .= '<url>';
$output .= '<loc>' . HTTP_SERVER . '</loc>';
$output .= '<changefreq>weekly</changefreq>';
$output .= '<priority>1.0</priority>';
$output .= '</url>';

$output .= '<url>';
$output .= '<loc>' . HTTP_SERVER . 'news' . '</loc>';
$output .= '<changefreq>weekly</changefreq>';
$output .= '<priority>0.7</priority>';
$output .= '</url>';
2. Для тех кто использует модуль НОВОСТИ+ выводим все новости

$this->load->model('catalog/news');
		 
$news = $this->model_catalog_news->geturlNews();
		 
foreach ($news as $item) {
	$output .= '<url>';
	$output .= '<loc>' . $this->url->link('information/news', 'news_id=' . $item['news_id']) . '</loc>';
	$output .= '<changefreq>weekly</changefreq>';
	$output .= '<priority>0.7</priority>';
	$output .= '</url>';   
}
		 
$output .= '</urlset>';
Но важно в файле catalog/model/catalog/news.php добавить перед "public function getNews($data) {" следующий код:

public function geturlNews() {
 
$sql = "SELECT * FROM " . DB_PREFIX . "news n LEFT JOIN " . DB_PREFIX . "news_description nd ON (n.news_id = nd.news_id) LEFT JOIN " . DB_PREFIX . "news_to_store n2s ON (n.news_id = n2s.news_id) WHERE nd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND n2s.store_id = '" . (int)$this->config->get('config_store_id') . "' AND n.status = '1' ORDER BY n.date_added DESC";
 
if (isset($data['start']) || isset($data['limit'])) {
if ($data['start'] < 0) {
$data['start'] = 0;
} 
if ($data['limit'] < 1) {
$data['limit'] = 10;
} 
 
$sql .= " LIMIT " . (int)$data['start'] . "," . (int)$data['limit'];
} 
 
$query = $this->db->query($sql);
 
return $query->rows;
}
После подобных манипуляций получаем все товары без дублирования, ссылку на главную страницу и любые свои страницы, ссылки на новости модуля News+  ;) Змінено користувачем alferus
  • +1 3
Надіслати
Поділитися на інших сайтах


  • 1 month later...

Путем долгих экспериментов удалось настроить sitemap.xml без дублирования ссылок для ocStore 1.5.5.1.2 со включенным seoPro.

...

Где это все прописывать для НОВОСТИ+, я сделал по анологии самого файла, но он у меня выдал ошибку и не загрузил XML. Можно чуть более подробно?
Надіслати
Поділитися на інших сайтах


  • 1 month later...

Где это все прописывать для НОВОСТИ+, я сделал по анологии самого файла, но он у меня выдал ошибку и не загрузил XML. Можно чуть более подробно?

Прямо в файле /catalog/controller/feed/google_sitemap.php нужно добавлять.

 

Может кому пригодится, готовый доработанный google_sitemap.php для включенного seo_pro с добавленными ссылками на: главную, связаться с нами, страницу новости+ (www.domain.ru/news/) и страницы статей (www.domain.ru/news/blablabla):

<?php
class ControllerFeedGoogleSitemap extends Controller {
   public function index() {
	  if ($this->config->get('google_sitemap_status')) {
		 $output  = '<?xml version="1.0" encoding="UTF-8"?>';
		 $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';

		 $output .= '<url>';
		 $output .= '<loc>' . HTTP_SERVER . '</loc>';
		 $output .= '<changefreq>weekly</changefreq>';
		 $output .= '<priority>1.0</priority>';
		 $output .= '</url>';

		 $output .= '<url>';
		 $output .= '<loc>' . HTTP_SERVER . 'news/' . '</loc>';
		 $output .= '<changefreq>weekly</changefreq>';
		 $output .= '<priority>0.7</priority>';
		 $output .= '</url>';

		 $output .= '<url>';
		 $output .= '<loc>' . HTTP_SERVER . 'contact-us/' . '</loc>';
		 $output .= '<changefreq>weekly</changefreq>';
		 $output .= '<priority>0.5</priority>';
		 $output .= '</url>';
		 
		 $this->load->model('catalog/product');
		 
		 $products = $this->model_catalog_product->getProducts();
		 
		 foreach ($products as $product) {
			$output .= '<url>';
			$output .= '<loc>' . $this->url->link('product/product', 'product_id=' . $product['product_id']) . '</loc>';
			$output .= '<changefreq>weekly</changefreq>';
			$output .= '<priority>1.0</priority>';
			$output .= '</url>';   
		 }
		 
		 $this->load->model('catalog/category');
		 
		 $output .= $this->getCategories(0);
		 
		 $this->load->model('catalog/manufacturer');
		 
		 $manufacturers = $this->model_catalog_manufacturer->getManufacturers();
		 
		 foreach ($manufacturers as $manufacturer) {
			$output .= '<url>';
			$output .= '<loc>' . $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $manufacturer['manufacturer_id']) . '</loc>';
			$output .= '<changefreq>weekly</changefreq>';
			$output .= '<priority>0.7</priority>';
			$output .= '</url>';   
			
			$products = $this->model_catalog_product->getProducts(array('filter_manufacturer_id' => $manufacturer['manufacturer_id']));
			
			//foreach ($products as $product) {
			//   $output .= '<url>';
			//   $output .= '<loc>' . $this->url->link('product/product', 'manufacturer_id=' . $manufacturer['manufacturer_id'] . '&product_id=' . $product['product_id']) . '</loc>';
			//   $output .= '<changefreq>weekly</changefreq>';
			//   $output .= '<priority>1.0</priority>';
			//   $output .= '</url>';   
			//}         
		 }
		 
		 $this->load->model('catalog/information');
		 
		 $informations = $this->model_catalog_information->getInformations();
		 
		 foreach ($informations as $information) {
			$output .= '<url>';
			$output .= '<loc>' . $this->url->link('information/information', 'information_id=' . $information['information_id']) . '</loc>';
			$output .= '<changefreq>weekly</changefreq>';
			$output .= '<priority>0.5</priority>';
			$output .= '</url>';   
		 }
		 
		 $this->load->model('catalog/news');
		 
		 $news = $this->model_catalog_news->geturlNews();
		 
		 foreach ($news as $item) {
			$output .= '<url>';
			$output .= '<loc>' . $this->url->link('information/news', 'news_id=' . $item['news_id']) . '</loc>';
			$output .= '<changefreq>weekly</changefreq>';
			$output .= '<priority>0.7</priority>';
			$output .= '</url>';   
		 }
		 
		 $output .= '</urlset>';
		 
		 $this->response->addHeader('Content-Type: application/xml');
		 $this->response->setOutput($output);
	  }
   }
   
   protected function getCategories($parent_id, $current_path = '') {
	  $output = '';
	  
	  $results = $this->model_catalog_category->getCategories($parent_id);
	  
	  foreach ($results as $result) {
		 if (!$current_path) {
			$new_path = $result['category_id'];
		 } else {
			$new_path = $current_path . '_' . $result['category_id'];
		 }

		 $output .= '<url>';
		 $output .= '<loc>' . $this->url->link('product/category', 'path=' . $new_path) . '</loc>';
		 $output .= '<changefreq>weekly</changefreq>';
		 $output .= '<priority>0.7</priority>';
		 $output .= '</url>';         

		 $products = $this->model_catalog_product->getProducts(array('filter_category_id' => $result['category_id']));
		 
		// foreach ($products as $product) {
		//	$output .= '<url>';
		//	$output .= '<loc>' . $this->url->link('product/product', 'path=' . $new_path . '&product_id=' . $product['product_id']) . '</loc>';
		//	$output .= '<changefreq>weekly</changefreq>';
		//	$output .= '<priority>1.0</priority>';
		//	$output .= '</url>';   
		//}   
		 
		   $output .= $this->getCategories($result['category_id'], $new_path);
	  }

	  return $output;
   }      
}
?>
Только не забываем редактировать catalog/model/catalog/news.php как написано выше. Спрашивайте лучше в личку. Змінено користувачем alferus
  • +1 1
Надіслати
Поділитися на інших сайтах


  • 7 months later...
  • 5 months later...

Большое спасибо! А подскажите как удалить из sitemap родительские категории?

 

В смысле удалить из него ссылки на категории вида "domain/category/" ? Нужно в файле /catalog/controller/feed/google_sitemap.php закомментить так:

//$output .= '<url>';//$output .= '<loc>' . $this->url->link('product/category', 'path=' . $new_path) . '</loc>';
//$output .= '<changefreq>weekly</changefreq>';
//$output .= '<priority>0.7</priority>';
//$output .= '</url>';   
Надіслати
Поділитися на інших сайтах


Гість
Ця тема закрита для публікації повідомлень.

×
×
  • Створити...

Important Information

На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність.