Hi all, I just put a new #showMetaDescription() Velocity macro into 5.1-SNAPSHOT that will work for both single-blog-entry and whole-blog URLs:

+#**
+Adds a meta description tag, suitable for use in HTML header sections. This tag is frequently used by +search engines to provide a short description for links returned. The description value will set to the +weblog's tagline if on a multiple blog entry page or the weblog entry search description if on a single +blog entry (permalink) page. If the relevant description value has not been configured no meta tag
+will be created.
+*#
+#macro(showMetaDescription)
+    #if ($model.permalink)
+        #if ($utils.isNotEmpty($model.weblogEntry.searchDescription))
+ <meta name="description" content="$model.weblogEntry.searchDescription">
+        #end
+    #elseif ($utils.isNotEmpty($model.weblog.description))
+        <meta name="description" content="$model.weblog.description">
+    #end
+#end

The templates that Roller comes packaged with are now using this macro.

Regards,
Glen

On 12/02/2013 07:42 AM, Greg Huber wrote:
Gaurav,

$model.weblog.description should work anywhere, make sure its set on the
<settings> Tagline field.

Also $model.weblogEntry.searchDescription is not manditory so its best to
check for null otherwise it will print
$model.weblogEntry.searchDescription in its place:

$utils.isNotEmpty($model.weblogEntry.searchDescription)
..
#end

Suppress field by quite notation : $!model.weblogEntry.searchDescription

Cheers Greg.



On 2 December 2013 12:19, Gaurav <gauravsain...@gmail.com> wrote:

Hello Glen,

Thanks a lot, "$model.weblogEntry.searchDescription" this works perfectly
fine in head.vm
Although, Is there any specific reason that why
"$model.weblog.description" not working in head.vm only, As this work fine
in entry.vm ?

Thanks
Gaurav


On Monday 02 December 2013 05:26 PM, Glen Mazza wrote:

OK, looking at the JIRA item: https://issues.apache.org/
jira/browse/ROL-1947, this is what needs to be used:

<meta name="Description" content="$model.weblogEntry.searchDescription">

This is what I have added in my header template.

#if ($model.permalink == false)
        <meta name="Description" content="$model.weblog.description">
#else
        <meta name="Description" content="$model.weblogEntry.
searchDescription">
#end

The upper one is for when the page is showing several blog entries at
once (such as being on the blog home page), in that case the blog
description as given on the Preferences | Settings page is used.  The
second one is for when a single blog entry is shown (common for Google hits
to go directly to a single blog entry), in this case the individual entry's
searchDescription is used.  Right now for some reason I can't get
"$model.weblog.description" to work but at least 
"$model.weblogEntry.searchDescription"
is working.

HTH,
Glen

On 12/02/2013 05:27 AM, Greg Huber wrote:

Glen,

You can only use the $entry when you are in a #foreach loop as the $entry
refers to the current weblog item iteration:

#foreach( $entry in $entries )
.....
#end

I do not think you can easily use blog entries in the <head> section
without changing the logic some what.


I have checked the code and within #foreach( $entry in $entries ) the
$entry.searchDescription works as expected.

Cheers Greg.



On 1 December 2013 17:53, Glen Mazza <glen.ma...@gmail.com> wrote:

  Actually, I don't see how that can have anything to do with it.
Glen

On 12/01/2013 12:43 PM, Glen Mazza wrote:

  BTW, JSPWiki upgraded to Lucene 4.6 a few days ago, could that be it?
Glen

On 12/01/2013 12:24 PM, Dave wrote:

  On Sun, Dec 1, 2013 at 12:04 PM, Glen Mazza <glen.ma...@gmail.com>
wrote:

   (on second thought, switching back to dev@...   :)

Also, the Roller blog itself which is on SNAPSHOT is no longer having
its
blog articles expanded: http://rollerweblogger.org/project/, that
was
working fine just a week or so ago.  I'm not sure what the problem
is, I
don't think I was working in this area.

   Very strange. I *know* that I checked and rechecked the Roller
project

blog
last week after the upgrade because I had to do so much work on the
JSPWiki
plugin to get the project blog to render correctly.

- Dave



--
Regards,
*Gaurav Saini*
/Developer, Digital Marketing and Pursuing B.Tech/
/Viithiisys Technologies/
/Email: gauravsain...@gmail.com, gaurav.sa...@viithiisys.com/
/Mobile: +91-9915346686/


Reply via email to