Yii Framework Forum: Yii, SEO, registerResource - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii, SEO, registerResource Rate Topic: -----

#1 User is offline   ajaxian 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 164
  • Joined: 02-June 10

Posted 24 October 2010 - 02:58 AM

Hi,
I see that when you register javascript or css style, Yii insert those resources at the very begin of the head html statement.
Then title html statement is quite far from the top of the file.

And Search Engine like the title statement at the top of the html file.

is there a way to indicate to Yii that he has to place its resources in another part of the header?



Thanks
0

#2 User is offline   ajaxian 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 164
  • Joined: 02-June 10

Posted 24 October 2010 - 03:02 AM

Sorry to poluate forum with 2 identical post. But when I posted I get an SQL Error message. Then I try again and I saw my 2 identical posts

sorry :blink:
0

#3 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,358
  • Joined: 12-October 09
  • Location:Croatia

Posted 24 October 2010 - 03:25 AM

**Duplicate post deleted**

Google likes the TITLE statement... it's place is in the HEAD section... it's not important where TITLE is located as long as it is in the HEAD section...

How do you register javascript or css styles?

Check these resources:

http://yiiframework....Position-detail

In fact check all the CClientScript class - http://yiiframework....1/CClientScript all methods for registering scripts has the property 'position'
Find more about me.... btw. Do you know your WAN IP?
0

#4 User is offline   ajaxian 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 164
  • Joined: 02-June 10

Posted 24 October 2010 - 03:42 AM

Many many thanks mdomba for your reply.
(I thought I was alone)

Google Like Title at the very first place in html document. Some years in SEO lead me think I'm right.

But Ok I can admit I'm wrong also, because I'm not in Google mind.

I write :
$cs=Yii::app()->getClientScript();
$cs->registerCoreScript('jquery');
$cs->coreScriptPosition = CClientScript::POS_END;

I would have prefer to have the capability to insert it AFTER the TITLE.
In the case I would like to add this possibility, then extending a Core class, Where can I place my own CClientScript class ?

Thanks
0

#5 User is offline   ajaxian 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 164
  • Joined: 02-June 10

Posted 24 October 2010 - 03:57 AM

Works perfect.
<?php $cs=Yii::app()->getClientScript();
		$cs->registerCoreScript('jquery');
		
		$url = Yii::app()->request->baseUrl;
		$cs->registerScriptFile($url.'/tinymce/jscripts/tiny_mce/tiny_mce.js',CClientScript::POS_END);
		$cs->registerScriptFile($url.'/js/admin.js',CClientScript::POS_END);
		$cs->registerScript('js1','	tinyMCE.init({
					mode : "textareas",
					theme : "simple"   //(n.b. no trailing comma, this will be critical as you experiment later)
				});',CClientScript::POS_END);
		$cs->coreScriptPosition = CClientScript::POS_END;
	?>

Every things are located at the end of body, in respect (order) of the declared statements.
0

#6 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,358
  • Joined: 12-October 09
  • Location:Croatia

Posted 24 October 2010 - 03:59 AM

You are not alone, it's just that on work-days there are more usrs visiting the forum...

As for the TITLE there is no reason why should google want it above... TITLE should be in the HEAD section... and that's all... google will find it if it's there... it's better to pay attention what is written in the TITLE then where it is...

Check this discussion on TITLE position - http://www.webprowor...-Regards-To-SEO

Anyway if you want your <title> to be just below the <head>, edit <your project>/protected/view/layout/main.php and put the TITLE element where you want it... :)

Some more SEO info on TITLE:
http://www.webmaster...gle/3156806.htm
http://sixrevisions....eb-page-titles/
Find more about me.... btw. Do you know your WAN IP?
0

#7 User is offline   ajaxian 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 164
  • Joined: 02-June 10

Posted 24 October 2010 - 04:30 AM

Concerning TITLE I feel it is a never end story. Others very good specialist said the importance of placing head as I previously said. But anyway, you're right when you said the content of Title is more important.

I do not understand your hints 'editing the main layout file and placing the TITLE as I want'
If I use a widget like CGridView it will place the js and Css at the top, just before Title.
I can indicate js to be place in body, but I can't tell css to be placed just After Title for instance.

In the case you're right regarding Title position importance vs Google then it is not a problem.
In the case you're wrong, it would be an enhancement.

As final statement I could argue that no one could know the Google strategy regarding head analyse (how much code from <head> to </html> is it necessary to determine the duplicate content, and so on) then It would be great to said insert your registered js script and css Before or after an Html Tag.
The web article you pointed is of 2003. Things could also change (example meta keywords has less importance now)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users