R
R
raycheel2014-03-10 22:47:07
Yii
raycheel, 2014-03-10 22:47:07

SEO, CNC and other stray when using Yii - how?

Hello. During the development of the site, there were problems with the correct organization of dynamic titles, keywords and descriptions for non-static pages.
Actually the question is how to organize this business? Each page is required to have a corresponding title and an accompanying description.
2 problems arose immediately:
1) Pages are rendered before $content fires;
2) There can be many pages, where to store all the headers? For some cases, I use the database, but here is another story. Here the page is a single ActionIndex, with a list of articles. Those. it is not recorded in the database.
I can't figure out how to do this....

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri Morozov, 2014-03-10
@raycheel

1. Look at how the title is implemented (this is the property of the controller) and, by analogy, add description and keywords.
2. You can, for example, attach to a record in the table (for example) tbl_pages.
That is, you will store slug, title, description, meta_title, meta_description and meta_keywords there. Further, see point 1. When loading a record, simply assign the appropriate properties.
I deliberately separated the title and meta_title, since a separate control is often required (title - for display on the page, meta_title - for output in the meta tag).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question