Entry name before blog name in the title tag

View: New views
10 Messages — Rating Filter:   Alert me  

Entry name before blog name in the title tag

by Arise :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello.

I want to have the entry name before the blog name in the <title> tag when I'm looking at individual entries.

Can anyone please explain me what do I have to do?

I want to do this for seo purposes.

Re: Entry name before blog name in the title tag

by shalini israni :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I did not fully get you.. but to display the entry title wherever you
want you need to use $entry.getTitle()

Basically you can access any of the public methods of entry in your
velocity templates  using the $entry object in the Context....

Hope it helped....

--S

Arise wrote:
> Hello.
>
> I want to have the entry name before the blog name in the <title> tag when
> I'm looking at individual entries.
>
> Can anyone please explain me what do I have to do?
>
> I want to do this for seo purposes.
>  


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Blojsom-users mailing list
Blojsom-users@...
https://lists.sourceforge.net/lists/listinfo/blojsom-users

Re: Entry name before blog name in the title tag

by Arise :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks shalini. I've found a solution, but I don't know if this is the best...

In my asual-head.vm I've placed this:
(formated for easy reading)

<title>
#set($count = 0)
#foreach($entry in $BLOJSOM_ENTRIES)
    #set($count = $count + 1)
    #if ($count == 1)
        #set($name = $entry.getTitle())
    #end
#end
#if ($count == 1 )
   $name :
#end
#BlogName()</title>

but in the file is actualy like this, to get rid of the extra space:
<title>#set($count = 0)#foreach($entry in $BLOJSOM_ENTRIES)#set($count = $count + 1)#if ($count == 1)#set($name = $entry.getTitle())#end#end#if ($count == 1)$name : #end#BlogName()</title>


shalini, in order to use $entry.getTitle() I had to use first #foreach($entry in $BLOJSOM_ENTRIES).
Any advices to improve the code above? Or is this the right way?

In the code above I'm counting the number of entries, so in the main page the Blog name comes first. In the individual entries I want the entry.getTitle() followed by the Blog name.

Re: Entry name before blog name in the title tag

by shalini israni :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

:( i'm confused. I don't get what you're trying to do....

For individual entries if you want the $entry.getTitle() followed by Blog name, you can use #BlogName() like you see in most of the head files (for example asual-head.vm), after your $entry.getTitle()

You will have to do this in the entry files (for example asual-entry.vm), since if you look at the theme.vm (for example asual.vm) files, they already have this #foreach loop which iterates thru the $BLOJSOM_ENTRIES..

Also, refer to http://wiki.blojsom.com/wiki/display/blojsom/Template+Macros for a list of available stuff that you can use in your templates (Page not loading at the time of writing this...but try it anyway)


--S


Arise wrote:
Thanks shalini. I've found a solution, but I don't know if this is the
best...

In my asual-head.vm I've placed this:
(formated for easy reading)

<title>
#set($count = 0)
#foreach($entry in $BLOJSOM_ENTRIES)
    #set($count = $count + 1)
    #if ($count == 1)
        #set($name = $entry.getTitle())
    #end
#end
#if ($count == 1 ) 
   $name : 
#end
#BlogName()</title>

but in the file is actualy like this, to get rid of the extra space:
<title>#set($count = 0)#foreach($entry in $BLOJSOM_ENTRIES)#set($count =
$count + 1)#if ($count == 1)#set($name = $entry.getTitle())#end#end#if
($count == 1)$name : #end#BlogName()</title>


shalini, in order to use $entry.getTitle() I had to use first
#foreach($entry in $BLOJSOM_ENTRIES).
Any advices to improve the code above? Or is this the right way?

In the code above I'm counting the number of entries, so in the main page
the Blog name comes first. In the individual entries I want the
entry.getTitle() followed by the Blog name.
  

DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Blojsom-users mailing list
Blojsom-users@...
https://lists.sourceforge.net/lists/listinfo/blojsom-users

Re: Entry name before blog name in the title tag

by Arise :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok, I'll try to explain a little bit.

Every page should have a html tag like: <title>blogName</title>.

For the main page I want to have something like: <title>blogName</title>.
For individual entries I want to have something like: <title>articleName : blogName</title>.

I've read this is good for SEO purposes.

For example, if you visit my blog (http://programaresociala.ro/) you see in the browser Title Bar the text: "Programare Sociala".
But if you go to an article (http://programaresociala.ro/2007/06/26/Temperaturi-extreme) you will set that the title bar text say something like: "Temperaturi extreme : Programare Sociala".

That is what I tried to do...

I've did this with the code above. Is another way to do it? without counting like an idiot all the entries with that "foreach" instruction?
How do I know if I'm in the main page (the blog page) or in an entry page?


shalini israni wrote:


 


:( i'm confused. I don't get what you're trying to do....

For individual entries if you want the $entry.getTitle() followed by
Blog name, you can use #BlogName() like you see in most of the head
files (for example asual-head.vm), after your $entry.getTitle()

You will have to do this in the entry files (for example
asual-entry.vm), since if you look at the theme.vm (for example
asual.vm) files, they already have this #foreach loop which iterates
thru the $BLOJSOM_ENTRIES..

Also, refer to http://wiki.blojsom.com/wiki/display/blojsom/Template+Macros
for a list of available stuff that you can use in your templates
(Page not loading at the time of writing this...but try it anyway)


--S


Arise wrote:

  Thanks shalini. I've found a solution, but I don't know if this is the
best...

In my asual-head.vm I've placed this:
(formated for easy reading)

<title>
#set($count = 0)
#foreach($entry in $BLOJSOM_ENTRIES)
    #set($count = $count + 1)
    #if ($count == 1)
        #set($name = $entry.getTitle())
    #end
#end
#if ($count == 1 )
   $name :
#end
#BlogName()</title>

but in the file is actualy like this, to get rid of the extra space:
<title>#set($count = 0)#foreach($entry in $BLOJSOM_ENTRIES)#set($count =
$count + 1)#if ($count == 1)#set($name = $entry.getTitle())#end#end#if
($count == 1)$name : #end#BlogName()</title>


shalini, in order to use $entry.getTitle() I had to use first
#foreach($entry in $BLOJSOM_ENTRIES).
Any advices to improve the code above? Or is this the right way?

In the code above I'm counting the number of entries, so in the main page
the Blog name comes first. In the individual entries I want the
entry.getTitle() followed by the Blog name.
 


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.




-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Blojsom-users mailing list
Blojsom-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/blojsom-users

Re: Entry name before blog name in the title tag

by Cliffano Subagio :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This will set the title to your blog name by default and overwrite it with any entry title on permalink view.

#set ( $title = "Your blog name" )
#if ($BLOJSOM_PERMALINK)
   #foreach ($entry in $BLOJSOM_ENTRIES)
       #set ( $title = "$entry.getTitle()" )
   #end
#end
<title>$title</title>

On 6/27/07, Arise <against_spamz@...> wrote:

Ok, I'll try to explain a little bit.

Every page should have a html tag like: <title>blogName</title>.

For the main page I want to have something like: <title>blogName</title>.
For individual entries I want to have something like: <title>articleName :
blogName</title>.

I've read this is good for SEO purposes.

For example, if you visit my blog (http://programaresociala.ro/) you see in
the browser Title Bar the text: "Programare Sociala".
But if you go to an article
(http://programaresociala.ro/2007/06/26/Temperaturi-extreme) you will set
that the title bar text say something like: "Temperaturi extreme :
Programare Sociala".

That is what I tried to do...

I've did this with the code above. Is another way to do it? without counting
like an idiot all the entries with that "foreach" instruction?
How do I know if I'm in the main page (the blog page) or in an entry page?



shalini israni wrote:

>
>
>
>
>
>
>
> :( i'm confused. I don't get what you're trying to do....
>
> For individual entries if you want the $entry.getTitle() followed by
> Blog name, you can use #BlogName() like you see in most of the head
> files (for example asual-head.vm), after your $entry.getTitle()
>
> You will have to do this in the entry files (for example
> asual-entry.vm), since if you look at the theme.vm (for example
> asual.vm) files, they already have this #foreach loop which iterates
> thru the $BLOJSOM_ENTRIES..
>
> Also, refer to
> http://wiki.blojsom.com/wiki/display/blojsom/Template+Macros
> for a list of available stuff that you can use in your templates
> (Page not loading at the time of writing this...but try it anyway)
>
>
> --S
>
>
> Arise wrote:
>
>   Thanks shalini. I've found a solution, but I don't know if this is the
> best...
>
> In my asual-head.vm I've placed this:
> (formated for easy reading)
>
> <title>
> #set($count = 0)
> #foreach($entry in $BLOJSOM_ENTRIES)
>     #set($count = $count + 1)
>     #if ($count == 1)
>         #set($name = $entry.getTitle())
>     #end
> #end
> #if ($count == 1 )
>    $name :
> #end
> #BlogName()</title>
>
> but in the file is actualy like this, to get rid of the extra space:
> <title>#set($count = 0)#foreach($entry in
> $BLOJSOM_ENTRIES)#set($count =
> $count + 1)#if ($count == 1)#set($name = $entry.getTitle())#end#end#if
> ($count == 1)$name : #end#BlogName()</title>
>
>
> shalini, in order to use $entry.getTitle() I had to use first
> #foreach($entry in $BLOJSOM_ENTRIES).
> Any advices to improve the code above? Or is this the right way?
>
> In the code above I'm counting the number of entries, so in the main page
> the Blog name comes first. In the individual entries I want the
> entry.getTitle() followed by the Blog name.
>
>
>
> DISCLAIMER
> ==========
> This e-mail may contain privileged and confidential information which is
> the property of Persistent Systems Pvt. Ltd. It is intended only for the
> use of the individual or entity to which it is addressed. If you are not
> the intended recipient, you are not authorized to read, retain, copy,
> print, distribute or use this message. If you have received this
> communication in error, please notify the sender and delete all copies of
> this message. Persistent Systems Pvt. Ltd. does not accept any liability
> for virus infected mails.
>
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Blojsom-users mailing list
> Blojsom-users@...
> https://lists.sourceforge.net/lists/listinfo/blojsom-users
>
>

--
View this message in context: http://www.nabble.com/Entry-name-before-blog-name-in-the-title-tag-tf3987384.html#a11323218
Sent from the Blojsom - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Blojsom-users mailing list
Blojsom-users@...
https://lists.sourceforge.net/lists/listinfo/blojsom-users


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Blojsom-users mailing list
Blojsom-users@...
https://lists.sourceforge.net/lists/listinfo/blojsom-users

Re: Entry name before blog name in the title tag

by shalini-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, i get you now  :-)

You could try one thing, but i'm not promising results!

Keep a variable $title in your asual.vm. And let yor page title be
<title>$title</title>

Now, in your asual-entry.vm, in the beginning, or in the if
(!$BLOJSOM_PERMALINK) condition, do a #set($title=
#BlogName/$entry.getTitle()) Please check how to concatenate the two
things for this #set().

I hope it makes sense... Its an idea you can try, but i'm not sure how
in what order the Page is loaded or Parsed. So assuming your
asual-entry.vm gets parsed after asual-head.vm (or asual-header.vm..
whichever one of them has the <title>$title</title>) .. this may or
maynot work...

--S

Arise wrote:

> Ok, I'll try to explain a little bit.
>
> Every page should have a html tag like: <title>blogName</title>.
>
> For the main page I want to have something like: <title>blogName</title>.
> For individual entries I want to have something like: <title>articleName :
> blogName</title>.
>
> I've read this is good for SEO purposes.
>
> For example, if you visit my blog (http://programaresociala.ro/) you see in
> the browser Title Bar the text: "Programare Sociala".
> But if you go to an article
> (http://programaresociala.ro/2007/06/26/Temperaturi-extreme) you will set
> that the title bar text say something like: "Temperaturi extreme :
> Programare Sociala".
>
> That is what I tried to do...
>
> I've did this with the code above. Is another way to do it? without counting
> like an idiot all the entries with that "foreach" instruction?
> How do I know if I'm in the main page (the blog page) or in an entry page?
>
>
>
> shalini israni wrote:
>  
>>
>>
>>  
>>
>>
>> :( i'm confused. I don't get what you're trying to do....
>>
>> For individual entries if you want the $entry.getTitle() followed by
>> Blog name, you can use #BlogName() like you see in most of the head
>> files (for example asual-head.vm), after your $entry.getTitle()
>>
>> You will have to do this in the entry files (for example
>> asual-entry.vm), since if you look at the theme.vm (for example
>> asual.vm) files, they already have this #foreach loop which iterates
>> thru the $BLOJSOM_ENTRIES..
>>
>> Also, refer to
>> http://wiki.blojsom.com/wiki/display/blojsom/Template+Macros
>> for a list of available stuff that you can use in your templates
>> (Page not loading at the time of writing this...but try it anyway)
>>
>>
>> --S
>>
>>
>> Arise wrote:
>>
>>   Thanks shalini. I've found a solution, but I don't know if this is the
>> best...
>>
>> In my asual-head.vm I've placed this:
>> (formated for easy reading)
>>
>> <title>
>> #set($count = 0)
>> #foreach($entry in $BLOJSOM_ENTRIES)
>>     #set($count = $count + 1)
>>     #if ($count == 1)
>>         #set($name = $entry.getTitle())
>>     #end
>> #end
>> #if ($count == 1 )
>>    $name :
>> #end
>> #BlogName()</title>
>>
>> but in the file is actualy like this, to get rid of the extra space:
>> <title>#set($count = 0)#foreach($entry in
>> $BLOJSOM_ENTRIES)#set($count =
>> $count + 1)#if ($count == 1)#set($name = $entry.getTitle())#end#end#if
>> ($count == 1)$name : #end#BlogName()</title>
>>
>>
>> shalini, in order to use $entry.getTitle() I had to use first
>> #foreach($entry in $BLOJSOM_ENTRIES).
>> Any advices to improve the code above? Or is this the right way?
>>
>> In the code above I'm counting the number of entries, so in the main page
>> the Blog name comes first. In the individual entries I want the
>> entry.getTitle() followed by the Blog name.
>>  
>>
>>
>> DISCLAIMER
>> ==========
>> This e-mail may contain privileged and confidential information which is
>> the property of Persistent Systems Pvt. Ltd. It is intended only for the
>> use of the individual or entity to which it is addressed. If you are not
>> the intended recipient, you are not authorized to read, retain, copy,
>> print, distribute or use this message. If you have received this
>> communication in error, please notify the sender and delete all copies of
>> this message. Persistent Systems Pvt. Ltd. does not accept any liability
>> for virus infected mails.
>>
>>
>>
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> _______________________________________________
>> Blojsom-users mailing list
>> Blojsom-users@...
>> https://lists.sourceforge.net/lists/listinfo/blojsom-users
>>
>>
>>    
>
>  
DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

[shalini_israni.vcf]

begin:vcard
fn:Shalini
n:;Shalini
org:Persistent Systems Pvt. Ltd;Techforum
email;internet:shalini_israni@...
title:Software Engineer
tel;work:+91 20 3023(5851)
url:http://www.persistentsys.com/
version:2.1
end:vcard



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Blojsom-users mailing list
Blojsom-users@...
https://lists.sourceforge.net/lists/listinfo/blojsom-users

Re: Entry name before blog name in the title tag

by shalini israni :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Cliff,

Won't this code set $title to the title of the very last entry in the
$BLOJSOM_ENTRIES array? Or maybe i have understood wrongly....

--S

Cliffano Subagio wrote:

> This will set the title to your blog name by default and overwrite it
> with any entry title on permalink view.
>
> #set ( $title = "Your blog name" )
> #if ($BLOJSOM_PERMALINK)
>    #foreach ($entry in $BLOJSOM_ENTRIES)
>        #set ( $title = "$entry.getTitle()" )
>    #end
> #end
> <title>$title</title>
>
> On 6/27/07, *Arise* < against_spamz@...
> <mailto:against_spamz@...>> wrote:
>
>
>     Ok, I'll try to explain a little bit.
>
>     Every page should have a html tag like: <title>blogName</title>.
>
>     For the main page I want to have something like:
>     <title>blogName</title>.
>     For individual entries I want to have something like:
>     <title>articleName :
>     blogName</title>.
>
>     I've read this is good for SEO purposes.
>
>     For example, if you visit my blog (http://programaresociala.ro/)
>     you see in
>     the browser Title Bar the text: "Programare Sociala".
>     But if you go to an article
>     (http://programaresociala.ro/2007/06/26/Temperaturi-extreme) you
>     will set
>     that the title bar text say something like: "Temperaturi extreme :
>     Programare Sociala".
>
>     That is what I tried to do...
>
>     I've did this with the code above. Is another way to do it?
>     without counting
>     like an idiot all the entries with that "foreach" instruction?
>     How do I know if I'm in the main page (the blog page) or in an
>     entry page?
>
>
>
>     shalini israni wrote:
>     >
>     >
>     >
>     >
>     >
>     >
>     >
>     > :( i'm confused. I don't get what you're trying to do....
>     >
>     > For individual entries if you want the $entry.getTitle() followed by
>     > Blog name, you can use #BlogName() like you see in most of the head
>     > files (for example asual-head.vm), after your $entry.getTitle()
>     >
>     > You will have to do this in the entry files (for example
>     > asual-entry.vm), since if you look at the theme.vm (for example
>     > asual.vm) files, they already have this #foreach loop which
>     iterates
>     > thru the $BLOJSOM_ENTRIES..
>     >
>     > Also, refer to
>     > http://wiki.blojsom.com/wiki/display/blojsom/Template+Macros
>     > for a list of available stuff that you can use in your templates
>     > (Page not loading at the time of writing this...but try it anyway)
>     >
>     >
>     > --S
>     >
>     >
>     > Arise wrote:
>     >
>     >   Thanks shalini. I've found a solution, but I don't know if
>     this is the
>     > best...
>     >
>     > In my asual-head.vm I've placed this:
>     > (formated for easy reading)
>     >
>     > <title>
>     > #set($count = 0)
>     > #foreach($entry in $BLOJSOM_ENTRIES)
>     >     #set($count = $count + 1)
>     >     #if ($count == 1)
>     >         #set($name = $entry.getTitle())
>     >     #end
>     > #end
>     > #if ($count == 1 )
>     >    $name :
>     > #end
>     > #BlogName()</title>
>     >
>     > but in the file is actualy like this, to get rid of the extra
>     space:
>     > <title>#set($count = 0)#foreach($entry in
>     > $BLOJSOM_ENTRIES)#set($count =
>     > $count + 1)#if ($count == 1)#set($name =
>     $entry.getTitle())#end#end#if
>     > ($count == 1)$name : #end#BlogName()</title>
>     >
>     >
>     > shalini, in order to use $entry.getTitle() I had to use first
>     > #foreach($entry in $BLOJSOM_ENTRIES).
>     > Any advices to improve the code above? Or is this the right way?
>     >
>     > In the code above I'm counting the number of entries, so in the
>     main page
>     > the Blog name comes first. In the individual entries I want the
>     > entry.getTitle() followed by the Blog name.
>     >
>     >
>     >
>     > DISCLAIMER
>     > ==========
>     > This e-mail may contain privileged and confidential information
>     which is
>     > the property of Persistent Systems Pvt. Ltd. It is intended only
>     for the
>     > use of the individual or entity to which it is addressed. If you
>     are not
>     > the intended recipient, you are not authorized to read, retain,
>     copy,
>     > print, distribute or use this message. If you have received this
>     > communication in error, please notify the sender and delete all
>     copies of
>     > this message. Persistent Systems Pvt. Ltd. does not accept any
>     liability
>     > for virus infected mails.
>     >
>     >
>     >
>     >
>     >
>     -------------------------------------------------------------------------
>     > This SF.net email is sponsored by DB2 Express
>     > Download DB2 Express C - the FREE version of DB2 express and take
>     > control of your XML. No limits. Just data. Click to get it now.
>     > http://sourceforge.net/powerbar/db2/
>     > _______________________________________________
>     > Blojsom-users mailing list
>     > Blojsom-users@...
>     <mailto:Blojsom-users@...>
>     > https://lists.sourceforge.net/lists/listinfo/blojsom-users
>     <https://lists.sourceforge.net/lists/listinfo/blojsom-users>
>     >
>     >
>
>     --
>     View this message in context:
>     http://www.nabble.com/Entry-name-before-blog-name-in-the-title-tag-tf3987384.html#a11323218
>     <http://www.nabble.com/Entry-name-before-blog-name-in-the-title-tag-tf3987384.html#a11323218>
>     Sent from the Blojsom - User mailing list archive at Nabble.com
>     <http://Nabble.com>.
>
>
>     -------------------------------------------------------------------------
>     This SF.net email is sponsored by DB2 Express
>     Download DB2 Express C - the FREE version of DB2 express and take
>     control of your XML. No limits. Just data. Click to get it now.
>     http://sourceforge.net/powerbar/db2/
>     <http://sourceforge.net/powerbar/db2/>
>     _______________________________________________
>     Blojsom-users mailing list
>     Blojsom-users@...
>     <mailto:Blojsom-users@...>
>     https://lists.sourceforge.net/lists/listinfo/blojsom-users
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> ------------------------------------------------------------------------
>
> _______________________________________________
> Blojsom-users mailing list
> Blojsom-users@...
> https://lists.sourceforge.net/lists/listinfo/blojsom-users
>  


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Blojsom-users mailing list
Blojsom-users@...
https://lists.sourceforge.net/lists/listinfo/blojsom-users

Re: Entry name before blog name in the title tag

by David Czarnecki :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If it's a permalink, you'll only have one entry.


On 6/27/07 8:29 AM, "Shalini" <shaliny.i@...> wrote:

> Hi Cliff,
>
> Won't this code set $title to the title of the very last entry in the
> $BLOJSOM_ENTRIES array? Or maybe i have understood wrongly....
>
> --S
>
> Cliffano Subagio wrote:
>> This will set the title to your blog name by default and overwrite it
>> with any entry title on permalink view.
>>
>> #set ( $title = "Your blog name" )
>> #if ($BLOJSOM_PERMALINK)
>>    #foreach ($entry in $BLOJSOM_ENTRIES)
>>        #set ( $title = "$entry.getTitle()" )
>>    #end
>> #end
>> <title>$title</title>
>>
>> On 6/27/07, *Arise* < against_spamz@...
>> <mailto:against_spamz@...>> wrote:
>>
>>
>>     Ok, I'll try to explain a little bit.
>>
>>     Every page should have a html tag like: <title>blogName</title>.
>>
>>     For the main page I want to have something like:
>>     <title>blogName</title>.
>>     For individual entries I want to have something like:
>>     <title>articleName :
>>     blogName</title>.
>>
>>     I've read this is good for SEO purposes.
>>
>>     For example, if you visit my blog (http://programaresociala.ro/)
>>     you see in
>>     the browser Title Bar the text: "Programare Sociala".
>>     But if you go to an article
>>     (http://programaresociala.ro/2007/06/26/Temperaturi-extreme) you
>>     will set
>>     that the title bar text say something like: "Temperaturi extreme :
>>     Programare Sociala".
>>
>>     That is what I tried to do...
>>
>>     I've did this with the code above. Is another way to do it?
>>     without counting
>>     like an idiot all the entries with that "foreach" instruction?
>>     How do I know if I'm in the main page (the blog page) or in an
>>     entry page?
>>
>>
>>
>>     shalini israni wrote:
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> :( i'm confused. I don't get what you're trying to do....
>>>
>>> For individual entries if you want the $entry.getTitle() followed by
>>> Blog name, you can use #BlogName() like you see in most of the head
>>> files (for example asual-head.vm), after your $entry.getTitle()
>>>
>>> You will have to do this in the entry files (for example
>>> asual-entry.vm), since if you look at the theme.vm (for example
>>> asual.vm) files, they already have this #foreach loop which
>>     iterates
>>> thru the $BLOJSOM_ENTRIES..
>>>
>>> Also, refer to
>>> http://wiki.blojsom.com/wiki/display/blojsom/Template+Macros
>>> for a list of available stuff that you can use in your templates
>>> (Page not loading at the time of writing this...but try it anyway)
>>>
>>>
>>> --S
>>>
>>>
>>> Arise wrote:
>>>
>>>   Thanks shalini. I've found a solution, but I don't know if
>>     this is the
>>> best...
>>>
>>> In my asual-head.vm I've placed this:
>>> (formated for easy reading)
>>>
>>> <title>
>>> #set($count = 0)
>>> #foreach($entry in $BLOJSOM_ENTRIES)
>>>     #set($count = $count + 1)
>>>     #if ($count == 1)
>>>         #set($name = $entry.getTitle())
>>>     #end
>>> #end
>>> #if ($count == 1 )
>>>    $name :
>>> #end
>>> #BlogName()</title>
>>>
>>> but in the file is actualy like this, to get rid of the extra
>>     space:
>>> <title>#set($count = 0)#foreach($entry in
>>> $BLOJSOM_ENTRIES)#set($count =
>>> $count + 1)#if ($count == 1)#set($name =
>>     $entry.getTitle())#end#end#if
>>> ($count == 1)$name : #end#BlogName()</title>
>>>
>>>
>>> shalini, in order to use $entry.getTitle() I had to use first
>>> #foreach($entry in $BLOJSOM_ENTRIES).
>>> Any advices to improve the code above? Or is this the right way?
>>>
>>> In the code above I'm counting the number of entries, so in the
>>     main page
>>> the Blog name comes first. In the individual entries I want the
>>> entry.getTitle() followed by the Blog name.
>>>
>>>
>>>
>>> DISCLAIMER
>>> ==========
>>> This e-mail may contain privileged and confidential information
>>     which is
>>> the property of Persistent Systems Pvt. Ltd. It is intended only
>>     for the
>>> use of the individual or entity to which it is addressed. If you
>>     are not
>>> the intended recipient, you are not authorized to read, retain,
>>     copy,
>>> print, distribute or use this message. If you have received this
>>> communication in error, please notify the sender and delete all
>>     copies of
>>> this message. Persistent Systems Pvt. Ltd. does not accept any
>>     liability
>>> for virus infected mails.
>>>
>>>
>>>
>>>
>>>
>>     -------------------------------------------------------------------------
>>> This SF.net email is sponsored by DB2 Express
>>> Download DB2 Express C - the FREE version of DB2 express and take
>>> control of your XML. No limits. Just data. Click to get it now.
>>> http://sourceforge.net/powerbar/db2/
>>> _______________________________________________
>>> Blojsom-users mailing list
>>> Blojsom-users@...
>>     <mailto:Blojsom-users@...>
>>> https://lists.sourceforge.net/lists/listinfo/blojsom-users
>>     <https://lists.sourceforge.net/lists/listinfo/blojsom-users>
>>>
>>>
>>
>>     --
>>     View this message in context:
>>    
>> http://www.nabble.com/Entry-name-before-blog-name-in-the-title-tag-tf3987384.
>> html#a11323218
>>    
>> <http://www.nabble.com/Entry-name-before-blog-name-in-the-title-tag-tf3987384
>> .html#a11323218>
>>     Sent from the Blojsom - User mailing list archive at Nabble.com
>>     <http://Nabble.com>.
>>
>>
>>     -------------------------------------------------------------------------
>>     This SF.net email is sponsored by DB2 Express
>>     Download DB2 Express C - the FREE version of DB2 express and take
>>     control of your XML. No limits. Just data. Click to get it now.
>>     http://sourceforge.net/powerbar/db2/
>>     <http://sourceforge.net/powerbar/db2/>
>>     _______________________________________________
>>     Blojsom-users mailing list
>>     Blojsom-users@...
>>     <mailto:Blojsom-users@...>
>>     https://lists.sourceforge.net/lists/listinfo/blojsom-users
>>
>>
>> ------------------------------------------------------------------------
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2 express and take
>> control of your XML. No limits. Just data. Click to get it now.
>> http://sourceforge.net/powerbar/db2/
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Blojsom-users mailing list
>> Blojsom-users@...
>> https://lists.sourceforge.net/lists/listinfo/blojsom-users
>>  
>
>
> DISCLAIMER
> ==========
> This e-mail may contain privileged and confidential information which is the
> property of Persistent Systems Pvt. Ltd. It is intended only for the use of
> the individual or entity to which it is addressed. If you are not the intended
> recipient, you are not authorized to read, retain, copy, print, distribute or
> use this message. If you have received this communication in error, please
> notify the sender and delete all copies of this message. Persistent Systems
> Pvt. Ltd. does not accept any liability for virus infected mails.
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Blojsom-users mailing list
> Blojsom-users@...
> https://lists.sourceforge.net/lists/listinfo/blojsom-users

--
David Czarnecki

http://www.blojsom.com/blog/ | http://blojsom.sf.net



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Blojsom-users mailing list
Blojsom-users@...
https://lists.sourceforge.net/lists/listinfo/blojsom-users

Re: Entry name before blog name in the title tag

by Arise :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks everyone for their answers.

This is the code I've used in the end:

#set ( $title = "#BlogName()")
#if ($BLOJSOM_PERMALINK)
   #foreach ($entry in $BLOJSOM_ENTRIES)
       #set ( $title = "$entry.getTitle() : #BlogName()" )
   #end
#end
<title>$title</title>

Looks better than my spaghetti. :)