Normal Panel would do it too.
Someone else recently asked for OpenGraph/Facebook meta headers recently in
this mailing lists. Check the archives.


On Tue, Mar 4, 2014 at 3:34 PM, Andrea Del Bene <[email protected]>wrote:

> Hi,
>
> use a custom StringHeaderItem and add it into renderHead. I recently
> implemented such a header item that can be useful for this purpose:
>
> public class MetaTagHeaderItem extends StringHeaderItem {
>
>     public MetaTagHeaderItem(CharSequence string) {
>         super(string);
>     }
>
>     public static StringHeaderItem forMetaTag(Map<String, IModel<String>>
> attributes) {
>         return forTag("    <meta ", attributes);
>     }
>
>     public static StringHeaderItem forTag(String tag, Map<String,
> IModel<String>> attributes) {
>         return forString(tag + generateAttributes(attributes) + "/>\n");
>     }
>
>     public static String generateAttributes(Map<String, IModel<String>>
> attributes) {
>         StringBuffer sb = new StringBuffer();
>
>         for (Entry<String, IModel<String>> model : attributes.entrySet()) {
>             String modelValue = model.getValue().getObject();
>
>             // generate 'attributeName="attributeValue" ' (without single
> quotes)
>             if (!Strings.isEmpty(modelValue)) {
> sb.append(model.getKey()).append("=\"").append(
> JavaScriptUtils.escapeQuotes(modelValue)).append("\" ");
>             }
>         }
>
>         return sb.toString();
>
>     }
>
> }
>
>> I need to set meta tag property as I want for facebook and OpenGraph with
>> wicket.
>>
>> <meta property="fb:app_id" content="117243945141208" />
>> <meta property="og:site_name" content="site.com" />
>> <meta property="og:type" content="website" />
>> <meta property="og:title" content="title variable" />
>> <meta property="og:url" content="http://www.site.com/......"; />
>> <meta property="og:description" content="Description variable" />
>> <meta property="og:image" content="http://www.site.com/images/...."; />
>>
>> An example code is welcomed because I am a newbie. Thanks.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to