|
@@ -171,11 +171,11 @@ class DefaultController extends Controller
|
|
{
|
|
{
|
|
$dom = new DOMDocument('1.0', 'UTF-8');
|
|
$dom = new DOMDocument('1.0', 'UTF-8');
|
|
$urlset = $dom->createElement('urlset');
|
|
$urlset = $dom->createElement('urlset');
|
|
- $urlset->setAttribute('xmlns:xsi','https://www.w3.org/2001/XMLSchema-instance');
|
|
|
|
- $urlset->setAttribute('xmlns','https://www.sitemaps.org/schemas/sitemap/0.9');
|
|
|
|
- $urlset->setAttribute('xsi:schemaLocation',"https://www.sitemaps.org/schemas/sitemap/0.9 https://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd");
|
|
|
|
- $urlset->setAttribute('xmlns:image',"https://www.google.com/schemas/sitemap-image/1.1");
|
|
|
|
- $urlset->setAttribute('xmlns:news',"https://www.google.com/schemas/sitemap-news/0.9");
|
|
|
|
|
|
+ $urlset->setAttribute('xmlns:xsi','http://www.w3.org/2001/XMLSchema-instance');
|
|
|
|
+ $urlset->setAttribute('xmlns','http://www.sitemaps.org/schemas/sitemap/0.9');
|
|
|
|
+ $urlset->setAttribute('xsi:schemaLocation',"http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd");
|
|
|
|
+ $urlset->setAttribute('xmlns:image',"http://www.google.com/schemas/sitemap-image/1.1");
|
|
|
|
+ $urlset->setAttribute('xmlns:news',"http://www.google.com/schemas/sitemap-news/0.9");
|
|
foreach($this->items as $item)
|
|
foreach($this->items as $item)
|
|
{
|
|
{
|
|
$url = $dom->createElement('url');
|
|
$url = $dom->createElement('url');
|
|
@@ -236,13 +236,15 @@ class DefaultController extends Controller
|
|
$item['lastmod'] = $this->dateToW3C($model->dt_pub);
|
|
$item['lastmod'] = $this->dateToW3C($model->dt_pub);
|
|
}
|
|
}
|
|
if( !$yandex ){
|
|
if( !$yandex ){
|
|
- $item['image:image'] = [
|
|
|
|
- 'image:loc' => $model->getImage('jpg')->getUrl(),
|
|
|
|
- 'image:caption' => ( $model->photo_title == '' )?$model->title:$model->photo_title //get_imageTitle
|
|
|
|
- ];
|
|
|
|
|
|
+ if( $model->getImage('jpg')->getUrl() ){
|
|
|
|
+ $item['image:image'] = [
|
|
|
|
+ 'image:loc' => $model->getImage('jpg')->getUrl(),
|
|
|
|
+ 'image:caption' => ( $model->photo_title == '' )?$model->title:$model->photo_title //get_imageTitle
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
|
|
$item['news:news'] =[
|
|
$item['news:news'] =[
|
|
- 'news:publication_date' => $model->dt_pub,
|
|
|
|
|
|
+ 'news:publication_date' => $this->dateToW3C($model->dt_pub),
|
|
'news:title' => $model->title,
|
|
'news:title' => $model->title,
|
|
'news:publication' =>
|
|
'news:publication' =>
|
|
[
|
|
[
|