You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Pointbreak <po...@ml1.net> on 2013/03/19 13:42:36 UTC

Prioritize header items in html templates

Is there a way (in Wicket 6) to prioritize items in wicket:head/head
elements to get them inside the head of the final page before all code
contributed header items? I.e. something like PriorityHeaderItem, but
applied to the markup of an item in the wicket:head of a template?

Thanks!

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Prioritize header items in html templates

Posted by Guillaume Smet <gu...@gmail.com>.
On Wed, Mar 20, 2013 at 11:48 PM, Guillaume Smet
<gu...@gmail.com> wrote:
> On Wed, Mar 20, 2013 at 12:58 PM, Martin Grigorov <mg...@apache.org> wrote:
>> Another user asked the same question so I added it to my demo app:
>> https://github.com/martin-g/blogs/commit/d5a248a3a3d5369c9cdc66604eba384428e9d0a0

FWIW, the following does the trick for me:
getResourceSettings().setHeaderItemComparator(new
PriorityFirstComparator(true));

The parameter of the PriorityFirstComparator constructor is
renderPageFirst. The default HeaderItemComparator is new
PriorityFirstComparator(false);

-- 
Guillaume

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Prioritize header items in html templates

Posted by Guillaume Smet <gu...@gmail.com>.
On Wed, Mar 20, 2013 at 12:58 PM, Martin Grigorov <mg...@apache.org> wrote:
> Another user asked the same question so I added it to my demo app:
> https://github.com/martin-g/blogs/commit/d5a248a3a3d5369c9cdc66604eba384428e9d0a0

Thanks Martin.

Very helpful.

-- 
Guillaume

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Prioritize header items in html templates

Posted by Martin Grigorov <mg...@apache.org>.
Another user asked the same question so I added it to my demo app:
https://github.com/martin-g/blogs/commit/d5a248a3a3d5369c9cdc66604eba384428e9d0a0


On Tue, Mar 19, 2013 at 9:31 PM, Martin Grigorov <mg...@apache.org>wrote:

> Actually I think it is possible to have them on the top.
> All "entries" from <wicket:head> are handled by PageHeaderItem at runtime.
> So you can use custom FilteringHeaderResponse that lifts PageHeaderItem to
> PriorityHeaderItem.
>
>
> On Tue, Mar 19, 2013 at 7:42 PM, Guillaume Smet <gu...@gmail.com>wrote:
>
>> Hi,
>>
>> On Tue, Mar 19, 2013 at 2:07 PM, Martin Grigorov <mg...@apache.org>
>> wrote:
>> > You can use StringHeaderItem.forString("<meta ...>") and wrap it in
>> > PriotityHeaderItem/FilterHeaderItem if needed.
>>
>> We had the same question. Starting with Wicket 6, <title> and so on
>> are lost in the resources lines. It was quite nice to have them on top
>> of the <head> and the resources at the bottom of the <head>,
>> especially when a customer starts to look at the HTML produced.
>>
>> I'm not sure having all these tags in the Java code is a good solution
>> for this issue.
>>
>> It's mostly cosmetic so it's probably not worth spending too much time
>> on this but if there is an easy solution for this issue, it might be
>> worth it.
>>
>> --
>> Guillaume
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Re: Prioritize header items in html templates

Posted by Martin Grigorov <mg...@apache.org>.
Actually I think it is possible to have them on the top.
All "entries" from <wicket:head> are handled by PageHeaderItem at runtime.
So you can use custom FilteringHeaderResponse that lifts PageHeaderItem to
PriorityHeaderItem.


On Tue, Mar 19, 2013 at 7:42 PM, Guillaume Smet <gu...@gmail.com>wrote:

> Hi,
>
> On Tue, Mar 19, 2013 at 2:07 PM, Martin Grigorov <mg...@apache.org>
> wrote:
> > You can use StringHeaderItem.forString("<meta ...>") and wrap it in
> > PriotityHeaderItem/FilterHeaderItem if needed.
>
> We had the same question. Starting with Wicket 6, <title> and so on
> are lost in the resources lines. It was quite nice to have them on top
> of the <head> and the resources at the bottom of the <head>,
> especially when a customer starts to look at the HTML produced.
>
> I'm not sure having all these tags in the Java code is a good solution
> for this issue.
>
> It's mostly cosmetic so it's probably not worth spending too much time
> on this but if there is an easy solution for this issue, it might be
> worth it.
>
> --
> Guillaume
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Re: Prioritize header items in html templates

Posted by Guillaume Smet <gu...@gmail.com>.
Hi,

On Tue, Mar 19, 2013 at 2:07 PM, Martin Grigorov <mg...@apache.org> wrote:
> You can use StringHeaderItem.forString("<meta ...>") and wrap it in
> PriotityHeaderItem/FilterHeaderItem if needed.

We had the same question. Starting with Wicket 6, <title> and so on
are lost in the resources lines. It was quite nice to have them on top
of the <head> and the resources at the bottom of the <head>,
especially when a customer starts to look at the HTML produced.

I'm not sure having all these tags in the Java code is a good solution
for this issue.

It's mostly cosmetic so it's probably not worth spending too much time
on this but if there is an easy solution for this issue, it might be
worth it.

-- 
Guillaume

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Prioritize header items in html templates

Posted by Martin Grigorov <mg...@apache.org>.
You can use StringHeaderItem.forString("<meta ...>") and wrap it in
PriotityHeaderItem/FilterHeaderItem if needed.


On Tue, Mar 19, 2013 at 3:03 PM, Pointbreak
<po...@ml1.net>wrote:

> The Java based header contributions are for css, and javascript mostly.
> Is there a practical way to get title, meta, and other 'special' tags
> appear before contributed headeritems in the head then?
>
> On Tue, Mar 19, 2013, at 13:48, Martin Grigorov wrote:
> > Hi,
> >
> > I think this is not possible.
> > <wicket:head> is just a convenience. The full power is in the Java based
> > header contributors.
> >
> >
> > On Tue, Mar 19, 2013 at 2:42 PM, Pointbreak
> > <po...@ml1.net>wrote:
> >
> > > Is there a way (in Wicket 6) to prioritize items in wicket:head/head
> > > elements to get them inside the head of the final page before all code
> > > contributed header items? I.e. something like PriorityHeaderItem, but
> > > applied to the markup of an item in the wicket:head of a template?
> > >
> > > Thanks!
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> >
> > --
> > Martin Grigorov
> > jWeekend
> > Training, Consulting, Development
> > http://jWeekend.com <http://jweekend.com/>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Re: Prioritize header items in html templates

Posted by Pointbreak <po...@ml1.net>.
The Java based header contributions are for css, and javascript mostly.
Is there a practical way to get title, meta, and other 'special' tags
appear before contributed headeritems in the head then?

On Tue, Mar 19, 2013, at 13:48, Martin Grigorov wrote:
> Hi,
> 
> I think this is not possible.
> <wicket:head> is just a convenience. The full power is in the Java based
> header contributors.
> 
> 
> On Tue, Mar 19, 2013 at 2:42 PM, Pointbreak
> <po...@ml1.net>wrote:
> 
> > Is there a way (in Wicket 6) to prioritize items in wicket:head/head
> > elements to get them inside the head of the final page before all code
> > contributed header items? I.e. something like PriorityHeaderItem, but
> > applied to the markup of an item in the wicket:head of a template?
> >
> > Thanks!
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 
> 
> -- 
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Prioritize header items in html templates

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

I think this is not possible.
<wicket:head> is just a convenience. The full power is in the Java based
header contributors.


On Tue, Mar 19, 2013 at 2:42 PM, Pointbreak
<po...@ml1.net>wrote:

> Is there a way (in Wicket 6) to prioritize items in wicket:head/head
> elements to get them inside the head of the final page before all code
> contributed header items? I.e. something like PriorityHeaderItem, but
> applied to the markup of an item in the wicket:head of a template?
>
> Thanks!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>