Answer the question
In order to leave comments, you need to log in
How to manage title and meta-tag on a website written in YII2?
How to manage title and meta-tag on a website written in YII2?
there is an entrance to the
site.com/backend admin panel
but there I see only a few pages in the "pages" section, how can I change the title on the remaining 300 pages?
Answer the question
In order to leave comments, you need to log in
Good evening.
I can offer two options so far.
First:
Write the content of the required tags in the params.php file and substitute it in the /layouts/main.php template
Second:
Create a table in the database and store the contents in it. Create a settings module where it will be possible to manage the content of tags. An example is here (for yii1, but easily modified for yii2)
The first option is for static data, the second for dynamic data.
The contents of the title tag can be set in a configuration file, and how this file is called depends on which application you are using, basic or advanced.
And a link to the documentation.
Registration of meta tags (English)
Registration of meta tags (Russian)
What a horror you have there, but the main thing is: <?= Html::csrfMetaTags() ?>
- it just brings them out. And you need to set them in the view (in view/somefolder/index.php, view/somefolder/create.php, etc.), and not in the layout (layout/some_name.php)
Like this:
$this->title = "мой тайтл";
$this->registerMetaTag(['name' => 'description', 'content' => 'мой супер пупер текст']);
thanks for the help!
but I'm not a website developer, I'm a system administrator who is tasked with changing the title, description, keywords
Therefore, I ask you to write a step-by-step algorithm for a non-developer, what should be opened for what to
update the title, description, keywords!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question