Which variable to use with tag linking for SEO
Posted: 27 September 2008 08:29 AM   [ Ignore ]
Jr. Member
RankRank
Total Posts:  48
Joined  2008-09-02

Does it matter if I use the websafe tag (which produces www.mysite.com/tag/websafe+tag) variable or the tag name variable (which would produce a url of www.mysite.com/tag/websafe%20tag that would show up in an up to date browser as www.mysite.com/tag/websafe tag) for linking. The reason I ask is that I’ve noticed I have it different in 2 different places but Google has cataloged the tag name variable rather than the websafe tag variable. Also, wouldn’t it be best practice to use a hypen rather than a + in the URL. I’ve heard that search engines recognize hypens as spaces and tend to be cataloged better.

Profile
 
 
Posted: 29 September 2008 06:15 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

Mike,

You can use the websafe_separator="+" parameter, which allows you to change the seperator for that matter.

For example, you could do this: smile

{exp:tag:cloud weblog="my_blog" category="favorite_category" groups="10" step="3" limit="40" websafe_separator="-"}
<a href="{path='tags/tag'}{websafe_tag}" title="{tag_name}" style="font-size:{step}px;">{tag}</a>{/exp:tag:cloud}

Though, just make sure you add this parameter to the Tag:Entries template should you use this method, and it’s expecting “+” to be the default seperator smile

 Signature 
Profile
 
 
Posted: 02 October 2008 12:13 AM   [ Ignore ]   [ # 2 ]
Jr. Member
RankRank
Total Posts:  48
Joined  2008-09-02

Thanks although I’m not sure what / where to look for the Tag:Entries template. There isn’t anything in my template groups or the module via FTP.

Profile
 
 
Posted: 02 October 2008 06:14 AM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

Tag 2.1 Entries Documentation smile

You’ll need to create a new template that contains the Tag:Entries loop in it to display the entries that relate to that Tag smile

 Signature 
Profile
 
 
Posted: 06 October 2008 03:14 PM   [ Ignore ]   [ # 4 ]
Jr. Member
RankRank
Total Posts:  48
Joined  2008-09-02

I’m still kind of at a loss even though I checked out the documentation. I can’t seem to find a template for tag:entries? From what you’re saying, I would assume I have one since the tags are all working fine...just they are using + instead of -.

Is there a way I can just change the default websafe separator that is used in the {websafe_tag} from + to -. Wouldn’t this be the easiest way?

Profile
 
 
Posted: 07 October 2008 07:32 AM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

By default, the {websafe_tag} variable as well as ALL other functions ASSUME that multiple word Tags will have a + instead of a space to seperate the words in the Tag.

You can change this behavior by adding this parameter to pretty much all functions/loops:

websafe_separator="-"

That example assumes you want to use - instead of +

The reason you cannot just do this for say, the Tag:Tags loop, is because if that Tag, which would now be generated as “multiple-word-tag” in the URL, will not be recognized if it’s clicked and you’re taken to the template with the Tag:Entries loop, because it’s expecting “multiple+word+tag” to be a valid Tag. Adding the websafe_separator="-" parameter to your Tag:Entries loop will now correct it’s thinking smile

 Signature 
Profile
 
 
Posted: 07 October 2008 07:58 AM   [ Ignore ]   [ # 6 ]
Jr. Member
RankRank
Total Posts:  48
Joined  2008-09-02
Pie Man - 07 October 2008 07:32 AM

By default, the {websafe_tag} variable as well as ALL other functions ASSUME that multiple word Tags will have a + instead of a space to seperate the words in the Tag.

I understand this but was wondering why I couldn’t just change this to -. Would this break some other functionality. For example, could I go into the mod file and replace all + with -? Sorry to be a boor here but I must be missing something.

When I add that websafe_separator="-" to the loop it creates the correct link but returns no results after clicking the link. I assume this goes back to the template issue you mentioned previously but I’m still unclear on what exactly you meant and didn’t find the documentation to be clear in this regard.  Thanks for your patience.

Profile
 
 
Posted: 07 October 2008 08:03 AM   [ Ignore ]   [ # 7 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18
mikeyoung - 07 October 2008 07:58 AM

When I add that websafe_separator="-" to the loop it creates the correct link but returns no results after clicking the link. I assume this goes back to the template issue you mentioned previously but I’m still unclear on what exactly you meant and didn’t find the documentation to be clear in this regard.  Thanks for your patience.

Yes, the websafe_separator="-" parameter needs to be added to the Tag:Entries template… there’s no question about it. wink

Can I see what your Tag:Entries template looks like? (The one that’s returning no results)
And can you paste in the URL you’re using to access it? smile

 Signature 
Profile
 
 
Posted: 07 October 2008 10:05 AM   [ Ignore ]   [ # 8 ]
Jr. Member
RankRank
Total Posts:  48
Joined  2008-09-02

As I mentioned above I actually don’t have a Tag:Entries template. I didn’t make the initial setup of this module so I assume that the template in question would be blogs/tag (I removed some of the unrelevant code to meet the length restrictions for a post):

{embed="globals/.header" section="{segment_1}" pagetitle="ELITETRACK Blogs"}


  
<div id="entries_by_tag" class="right w2 block fright">
   <
h2 class="block">Blog Entries by Tag</h2>
   <
div class="frame">
    <
div class="content">

{exp:tag:entries weblog="blogs" rdf="off" disable="trackbacks|member_data|categories" category="not 398" limit="5" paginate="bottom"}
     
<div class="entry">
      <
h3><a href="{permalink="blogs/details"}">{title}<span>[read more]</span></a></h3>
      <
div class="metadata">
       <
div class="author notice"><a href="{path=blogs/author}{exp:elitetrack:blog_author username='{username}'}/">{author}</a></div>
       <
div class="timestamp notice">{entry_date format="%l, %d %F %Y"}</div>
      </
div>
      <
div class="body">
       <
p class="body">{summary} [...]</p><a class="discuss" href="{path=forums/viewthread}{forum_topic_id}">({exp:elitetrack:topic_posts topic_id="{forum_topic_id}"}) Discuss entry</a>       
</
div>
     </
div>
{paginate}<p class="paginate">Page {current_page} of {total_pages} pages {pagination_links}</p>{/paginate}
{
/exp:tag:entries}

    
</div>
   </
div>
  </
div>

  <
div id="the_blogs" class="subnav left w1 block">
   <
h2 class="block">The Blogs</h2>
   <
div class="frame">
    <
div class="content">
     <
ul class="nav_list" class="list">
{exp:weblog:categories weblog="blogs" style="linear"}
      
<li class="{exp:elitetrack:equals this="{segment_3}" that="{category_url_title}" yes="even" no="odd"}"><p><span class="tot_entries notice">{exp:elitetrack:total_entries category_id="{category_id}"} entries</span><a href="{site_url}blogs/author/{cat_username}/">{category_name}</a><br/>{category_description}</p></li>
{/exp:weblog:categories}
     
</ul>
    </
div>
   </
div>
  </
div>


  <
div id="popular_blog_entries" class="left w1 block">
   <
h2 class="block">Popular Blog entries <a class="more" href="{path=blogs/popular}">more &raquo;</a></h2>
   <
div class="frame">
    <
div class="content">
     <
ul id="popular_blog" class="list">
{exp:weblog:entries weblog="blogs" dynamic="off" rdf="off" disable="trackbacks|member_data|pagination|categories" orderby="view_count_one" sort="desc" limit="4"}
      
<li><p><a href="{permalink=blogs/details}">{title}</a><br/><span class="date notice">{entry_date format="%Y-%m-%d %H:%i:%s"} by </span><a class="author" href="{member_search_path=search/results}">{author}</a></p></li>
{/exp:weblog:entries}
     
</ul>
    </
div>
   </
div>
  </
div>

  <
div id="blog_tag_cloud" class="left w1 block">
  
{embed="globals/tagcloud"}

And this is the code I’m using to retrieve (without the websafe modification)

{exp:tag:tags entry_id="{entry_id}" type="weblog" backspace="2" orderby="clicks" sort="desc"}
<a href="{path='blogs/tag'}{websafe_tag}/" title="{tag_name}">{tag}</a>, {/exp:tag:tags}

Profile
 
 
Posted: 08 October 2008 06:44 AM   [ Ignore ]   [ # 9 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18
mikeyoung - 07 October 2008 10:05 AM

...so I assume that the template in question would be blogs/tag…

Yes and No… wink

If the template is called “tag” and the template group is called “blogs”, then that’s fine. But you will need to link to it with the EXTRA trigger/marker in the URL from your Tag:Tags code:

<a href="{path='blogs/tag'}tag/{websafe_tag}/" title="{tag_name}">{tag}</a>

If that doesn’t make any sense, I can go into your CP and get things working…

 Signature 
Profile
 
 
Posted: 08 October 2008 07:23 AM   [ Ignore ]   [ # 10 ]
Jr. Member
RankRank
Total Posts:  48
Joined  2008-09-02

I think I’m starting to understand. The template is called “tag” and it’s in the template group called “blogs”. I’m not quite sure though how to implement what you’re suggesting. PM’ing you.

Profile