#390 add category seo information

This commit is contained in:
vedatakd 2019-09-05 15:59:38 +03:00
parent 24bb43f01c
commit 97f9365c30
9 changed files with 63 additions and 7 deletions

View File

@ -3,7 +3,7 @@
{% block ogdata %}
<meta property="og:site_name"
content="{{ template.get('og_site_name', setting_value('streams::name', config_get('streams::distribution.name'))) }}"/>
<meta property="og:description" content="{{ template.get('og_description', trans(template.meta_description)) }}"/>
<meta property="og:description" content="{{ adv.advs_desc|striptags|raw }}"/>
<meta property="og:title" content="{{ adv.title }}"/>
<meta property="og:url" content="{{ template.get('og_url', url_current()) }}"/>
<meta property="og:image" content="{{ adv.getViewPhotoUrl|first }}">

View File

@ -66,7 +66,6 @@ class AdvsController extends PublicController
{
$customParameters = array();
$param = $request->toArray();
$advmodel = new AdvModel();
$isActiveDopings = $advmodel->is_enabled('dopings');
$isActiveCustomFields = $advmodel->is_enabled('customfields');
@ -100,6 +99,15 @@ class AdvsController extends PublicController
if (isset($param['cat']) and $param['cat'] != "") {
$cat = $param['cat'];
$mainCats = new CategoryModel();
$seo_keywords = $mainCats->getMeta_keywords($param['cat']);
$seo_description = $mainCats->getMeta_description($param['cat']);
$seo_title = $mainCats->getMeta_title($param['cat']);
$this->template->set('meta_keywords', implode(',', $seo_keywords));
$this->template->set('meta_description', $seo_description);
$this->template->set('meta_title', $seo_title);
$mainCats = $mainCats->getParentCats($cat, 'category_ids');
$subCats = $categories->getSubCatById($cat);
} else {
@ -212,6 +220,9 @@ class AdvsController extends PublicController
$qrModel = new QrModel();
$qrSRC = $qrModel->source($adv);
}
$this->template->set('meta_keywords', implode(',',explode(' ',$adv->name)));
$this->template->set('meta_description', strip_tags($adv->advs_desc,''));
$this->template->set('meta_title', $adv->name."|".end($categories)['name']);
if ($adv->created_by_id == isset(auth()->user()->id) OR $adv->status == "approved") {

View File

@ -36,6 +36,9 @@ class VisiosoftModuleCatsCreateCatsFields extends Migration
'mode' => 'upload',
]
],
'seo_keyword' => 'anomaly.field_type.tags',
'seo_description' => 'anomaly.field_type.text',
];
}

View File

@ -37,7 +37,9 @@ class VisiosoftModuleCatsCreateCategoryStream extends Migration
'parent_category',
'order',
'deleted_at',
'files'
'files',
'seo_keyword',
'seo_description',
];
}

View File

@ -13,5 +13,11 @@ return [
'files' => [
'name' => 'Image'
],
'seo_keyword' => [
'name' => 'Seo Keyword'
],
'seo_description' => [
'name' => 'Seo Description'
],
'please_wait' => 'Please wait.Deleting Sub Categories',
];

View File

@ -17,5 +17,11 @@
"name" =>"görüntü",
],
'seo_keyword' => [
'name' => 'Seo Anahtar Kelimeler'
],
'seo_description' => [
'name' => 'Seo Açıklaması'
],
"please_wait" =>"Lütfen bekleyin. Alt Kategoriler Siliniyor"
];

View File

@ -25,6 +25,8 @@
value="{% if form.fields.parent_category.value.id is defined %}{{ form.fields.parent_category.value.id }}{% elseif app.request.get('parent') is defined %}{{ app.request.get('parent') }}{% endif %}">
{{ form.fields.order|raw }}
{{ form.fields.files|raw }}
{{ form.fields.seo_keyword|raw }}
{{ form.fields.seo_description|raw }}
</div><!-- section -->
</fieldset>
</div>

View File

@ -109,6 +109,21 @@ class CategoryModel extends CatsCategoryEntryModel implements CategoryInterface
public function getMainCategory()
{
return $this->where('parent_category_id',NULL)->get();
return $this->where('parent_category_id', NULL)->get();
}
public function getMeta_keywords($cat_id)
{
return $this->find($cat_id)->seo_keyword;
}
public function getMeta_description($cat_id)
{
return $this->find($cat_id)->seo_description;
}
public function getMeta_title($cat_id)
{
return $this->find($cat_id)->name;
}
}

View File

@ -21,11 +21,22 @@
<meta name="keywords"
content="{% for tag in setting_value('visiosoft.theme.default::meta_tags') %}{{ tag }},{% endfor %}">
{% else %}
<meta name="keywords" content="{% for tag in adv.meta_tags %}{{ tag }},{% endfor %}">
<meta name="keywords" content="{{ trans(template.meta_keywords) }},{% for tag in adv.meta_tags %}{{ tag }},{% endfor %}">
{% endif %}
<title>{{ setting_value('streams::name', config_get('streams::distribution.name')) }}|{{ trans(template.meta_title) }}</title>
{% if app.request.pathInfo == "advs/adv/" %}
{% block opengraph %}
<meta property="og:site_name"
content="{{ setting_value('streams::name', config_get('streams::distribution.name')) }}|{{ trans(template.meta_title) }}"/>
{#<meta property="og:image" content="{{ image_url('qcr.theme.qcr::img/og.png') }}"/>#}
<meta property="og:description" content="{{ trans(template.meta_description) }}"/>
<meta property="og:title" content="{{ setting_value('streams::name', config_get('streams::distribution.name')) }}|{{ trans(template.meta_title) }}"/>
<meta property="og:url" content="{{ url_current() }}"/>
<meta property="og:type" content="website"/>
{% endblock %}
{% endif %}
<title>{{ setting_value('streams::name', config_get('streams::distribution.name')) }}
|{{ trans(template.meta_title) }}</title>
<!-- Favicon -->
{#{{ favicons("theme::img/favicon.png") }}#}