fix sitemap

parent e244f260
...@@ -81,7 +81,7 @@ class Sitemap extends Module ...@@ -81,7 +81,7 @@ class Sitemap extends Module
$urls = array_merge($urls, $model->generateSiteMap()); $urls = array_merge($urls, $model->generateSiteMap());
} }
$langs = Languages::find()->where(['!=', 'default', 1])->all(); $langs = Languages::find()->all();
$sitemapData = $this->createControllerByID('default')->renderPartial('index', [ $sitemapData = $this->createControllerByID('default')->renderPartial('index', [
'urls' => $urls, 'urls' => $urls,
......
...@@ -19,7 +19,7 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL; ...@@ -19,7 +19,7 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL;
<?php if($langs) : <?php if($langs) :
foreach ($langs as $lang) : ?> foreach ($langs as $lang) : ?>
<xhtml:link rel="alternate" hreflang="<?=$lang->url?>" href="<?= yii\helpers\Url::to('/'.$lang->url.($url['loc']=='/'?'':'/'.$url['loc']), true) ?>"/> <xhtml:link rel="alternate" hreflang="<?=$lang->url?>" href="<?= yii\helpers\Url::to((!$lang->default?'/'.$lang->url:'').($url['loc']=='/'?'':'/'.$url['loc']), true) ?>"/>
<?php endforeach; <?php endforeach;
endif; ?> endif; ?>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment