Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taskonsite-архив-перенесен
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitry Korolev
taskonsite-архив-перенесен
Commits
e55d4271
Commit
e55d4271
authored
Feb 05, 2016
by
Олег Гиммельшпах
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix sitemap
parent
d0928771
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
49 deletions
+44
-49
common/modules/content/models/CoContent.php
common/modules/content/models/CoContent.php
+28
-1
common/modules/faq/models/Faq.php
common/modules/faq/models/Faq.php
+3
-20
frontend/config/main.php
frontend/config/main.php
+13
-28
No files found.
common/modules/content/models/CoContent.php
View file @
e55d4271
...
@@ -3,6 +3,10 @@
...
@@ -3,6 +3,10 @@
namespace
common\modules\content\models
;
namespace
common\modules\content\models
;
use
Yii
;
use
Yii
;
use
yii\behaviors\TimestampBehavior
;
use
himiklab\sitemap\behaviors\SitemapBehavior
;
use
\yii\helpers\Url
;
use
common\modules\content\models\CoBlocks
;
use
common\modules\content\models\CoBlocks
;
use
common\modules\languages\models\Languages
;
use
common\modules\languages\models\Languages
;
use
common\models\MetaTags
;
use
common\models\MetaTags
;
...
@@ -47,7 +51,30 @@ class CoContent extends \common\components\ActiveRecordModel
...
@@ -47,7 +51,30 @@ class CoContent extends \common\components\ActiveRecordModel
],
],
'langs'
=>
[
'langs'
=>
[
'class'
=>
'common\modules\content\components\CoContentLangBehavior'
,
'class'
=>
'common\modules\content\components\CoContentLangBehavior'
,
]
],
'timestamp'
=>
[
'class'
=>
TimestampBehavior
::
className
(),
'createdAtAttribute'
=>
'created_at'
,
'updatedAtAttribute'
=>
'updated_at'
,
'value'
=>
time
(),
],
'sitemap'
=>
[
'class'
=>
SitemapBehavior
::
className
(),
'scope'
=>
function
(
$model
)
{
/** @var \yii\db\ActiveQuery $model */
$model
->
select
([
'url'
,
'updated_at'
]);
// $model->andWhere(['is_deleted' => 0]);
},
'dataClosure'
=>
function
(
$model
)
{
/** @var self $model */
return
[
'loc'
=>
Url
::
to
(
$model
->
url
,
true
),
'lastmod'
=>
date
(
'c'
,
$model
->
updated_at
),
'changefreq'
=>
SitemapBehavior
::
CHANGEFREQ_DAILY
,
'priority'
=>
0.8
];
}
],
];
];
}
}
...
...
common/modules/faq/models/Faq.php
View file @
e55d4271
...
@@ -3,14 +3,14 @@
...
@@ -3,14 +3,14 @@
namespace
common\modules\faq\models
;
namespace
common\modules\faq\models
;
use
Yii
;
use
Yii
;
use
\common\components\validators\TransliterateValidator
;
use
yii\behaviors\TimestampBehavior
;
use
yii\behaviors\TimestampBehavior
;
use
\yii\helpers\StringHelper
;
use
\yii\helpers\StringHelper
;
use
\common\models\MetaTags
;
use
yii\helpers\Url
;
use
yii\helpers\Url
;
use
yii\db\Expression
;
use
yii\db\Expression
;
use
himiklab\sitemap\behaviors\SitemapBehavior
;
use
\common\models\MetaTags
;
use
\common\components\validators\TransliterateValidator
;
/**
/**
* This is the model class for table "faq".
* This is the model class for table "faq".
*
*
...
@@ -44,23 +44,6 @@ class Faq extends \common\components\ActiveRecordModel
...
@@ -44,23 +44,6 @@ class Faq extends \common\components\ActiveRecordModel
'meta'
=>
[
'meta'
=>
[
'class'
=>
'common\components\activeRecordBehaviors\MetaTagBehavior'
,
'class'
=>
'common\components\activeRecordBehaviors\MetaTagBehavior'
,
],
],
'sitemap'
=>
[
'class'
=>
SitemapBehavior
::
className
(),
'scope'
=>
function
(
$model
)
{
/** @var \yii\db\ActiveQuery $model */
$model
->
select
([
'url'
,
'updated_at'
]);
// $model->andWhere(['is_deleted' => 0]);
},
'dataClosure'
=>
function
(
$model
)
{
/** @var self $model */
return
[
'loc'
=>
Url
::
to
(
$model
->
url
,
true
),
'lastmod'
=>
date
(
'c'
,
$model
->
updated_at
),
'changefreq'
=>
SitemapBehavior
::
CHANGEFREQ_DAILY
,
'priority'
=>
0.8
];
}
],
'timestamp'
=>
[
'timestamp'
=>
[
'class'
=>
TimestampBehavior
::
className
(),
'class'
=>
TimestampBehavior
::
className
(),
'createdAtAttribute'
=>
'created_at'
,
'createdAtAttribute'
=>
'created_at'
,
...
...
frontend/config/main.php
View file @
e55d4271
...
@@ -27,36 +27,21 @@ return [
...
@@ -27,36 +27,21 @@ return [
'class'
=>
'himiklab\sitemap\Sitemap'
,
'class'
=>
'himiklab\sitemap\Sitemap'
,
'models'
=>
[
'models'
=>
[
// your models
// your models
'common\modules\
faq\models\Faq
'
,
'common\modules\
content\models\CoContent
'
,
],
],
'urls'
=>
[
'urls'
=>
[
// your additional urls
// // your additional urls
[
// [
'loc'
=>
'/faq'
,
// 'loc' => '/faq',
'changefreq'
=>
\himiklab\sitemap\behaviors\SitemapBehavior
::
CHANGEFREQ_DAILY
,
// 'changefreq' => \himiklab\sitemap\behaviors\SitemapBehavior::CHANGEFREQ_DAILY,
'priority'
=>
0.8
,
// 'priority' => 0.8,
'faq'
=>
[
// 'faq' => [
'publication'
=>
[
// 'publication' => [
'name'
=>
'Вопрос-Ответ'
,
// 'name' => 'Вопрос-Ответ',
'language'
=>
'ru'
,
// 'language' => 'ru',
],
// ],
// 'access' => 'Subscription',
// ],
// 'genres' => 'Blog, UserGenerated',
// ],
// 'publication_date' => 'YYYY-MM-DDThh:mm:ssTZD',
// 'title' => 'Example Title',
// 'keywords' => 'example, keywords, comma-separated',
// 'stock_tickers' => 'NASDAQ:A, NASDAQ:B',
],
// 'images' => [
// [
// 'loc' => 'http://example.com/image.jpg',
// 'caption' => 'This is an example of a caption of an image',
// 'geo_location' => 'City, State',
// 'title' => 'Example image',
// 'license' => 'http://example.com/license',
// ],
// ],
],
],
],
'enableGzip'
=>
true
,
// default is false
'enableGzip'
=>
true
,
// default is false
'cacheExpire'
=>
1
,
// 1 second. Default is 24 hours
'cacheExpire'
=>
1
,
// 1 second. Default is 24 hours
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment