Answer the question
In order to leave comments, you need to log in
Is it possible in Yii2 to automatically generate a title for a page hierarchy?
Hello. I tried to find in the documentation options for implementing automatic construction of titles for project pages. I would like the title structure to be formed according to the principle "site_name | title of pages_first_level" and so on (nesting may change). Of the solutions, I found only custom by type
<title><?= Yii::$app->name ?> | <?= Html::encode($this->title) ?></title>
Answer the question
In order to leave comments, you need to log in
Does Yii2 have a built-in solution for building titles, or do I need to use third-party components for this purpose?
There is no built-in mechanism in Yii2 that implements your task, look for ready-made extensions
No need to reinvent the wheel, first look for ready-made extensions, for example here , and if you don’t find anything suitable for you, then it makes sense to think about writing your own component
For these purposes, there are breadcrumps, not a title. Why shove it into the title? Let me remind you that the length of the title should ideally not exceed 71 characters. But if you really need it, you can make a widget on the same principle as breadcrumps is built.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question