Adding the publisher information is the easiest to tackle, as your entire site should be tagged as one publisher, so you can add it to the main layout simply by using the client script manager. The hardest part is making sure you have a brand Google+ page set up and getting the proper ID number.
In your main layout, or wherever you feel it is most appropriate for your situation, simply add:
Yii::app()->clientScript->registerLinkTag( 'publisher', null, "https://plus.google.com/{$profileId}" );
If you are the only author on the site, you can add your authorship information at the same time. Otherwise, you should add the author metadata only on the pages where it is most appropriate and using the Google+ profile page for the relevant author. You can do this from the Controller action, the view file or in a beforeAction method or a filter of the Controller if you have one author for a whole section of CViewAction pages, etc.
Yii::app()->clientScript->registerLinkTag( 'author', null, 'https://plus.google.com/u/0/'.$gPlus.'/' );
That's really all there is to it!!
No comments:
Post a Comment