• Post Reply Bookmark Topic Watch Topic
  • New Topic

Control Position of Resources within <h:head> in JSF 2.0  RSS feed

 
David Sawyer
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to control the location where resources are placed within <head></head> ?

I've noticed that most component libraries include css or js resources and that in the html output they appear at the very beginning of <head>. Ideally I would like them to appear at the very end right before </head> so that my title and meta elements are all above them. Any simple way to accomplish this?
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a difference that makes no difference, unless you're into opening up web page source and admiring the results. HTML itself won't care.

I'm not actually sure what, if any mods to the HTML head section JSF2 does. In earlier versions of some of the extended frameworks, there were several pre-defined points that could be used to arrange things so that they would produce stuff in the proper order. Mostly, this applies to ensuring that the relative precedences of CSS and JavaScript elements didn't get scrambled. However at the app developer level, the precise location wasn't being controlled, only the context.
 
David Sawyer
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I work for a company that spends lots of money on SEO advice and those guys are very picky about the title element and supporting meta elements being the first children of <head>.

In 1.2 it was easy enough to control the position of items in the markup. I totally respect and enjoy the modular nature of JSF 2.0 and the ability of components to easily include their supporting resources, but it would be nice if you could specify the location within <h:head> for resources to be included.
 
David Sawyer
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The SEO guys reviewed the site and are insisting that the js and css resources included by Openfaces and Richfaces be moved below the title and meta elements.

Does anyone else have any insight on how this can be accomplished (outside of a filter which would be horribly inefficient)?
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Who ARE these guys? Dogbert & Ratbert, LLC? I can't believe that any search engine of note would blindly assume the ordering of non-ordered elements.
 
David Sawyer
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
lol. yeah. it's tough. They argue that having these elements appear within the first X characters is important to some off-broadway non-Google search engines. They assume we're working w/ PHP or something and can't really appreciate the benefits of a component based paradigm.

Tim, do you happen to know where I could look in majarra to see how resources are introduced in the head. It seems like extension/decoration of this mechanism to change the position within the element shouldn't be terribly difficult.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Sawyer wrote:

Tim, do you happen to know where I could look in majarra to see how resources are introduced in the head. It seems like extension/decoration of this mechanism to change the position within the element shouldn't be terribly difficult.


I don't remember offhand. Only time I did anything like that in detail was using the MyFaces stuff prior to JSF2, where I was injecting Google Maps support JavaScript at the page header/footer. However it wouldn't have been trivial. What they did was provide a collection of named markers and then you injected stuff into them on a FIFO basis. The page renderer would decant the code for each marker in turn when it was darn good and ready to, and the only absolute guarantees as to position was that everything would be located in an appropriate place. No micro-managing.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!