How to optimize URL Was This Topic Useful? MOD

General discussions Forum for everything that does not fit elswhere in the phpbb SEO forums.

Moderator: Moderators

How to optimize URL Was This Topic Useful? MOD

Postby Crakinet » Thu Mar 10, 2011 7:03 am

Hi all,
I installed the MOD Was This Topic Useful? which is a mod that shows in the view topic the Link, BBcode and HTML
As I can modify the following code to display the URL for phpBB SEO

Code: Select all
'WTU_BBCODE'      => append_sid(generate_board_url() . "/viewtopic.$phpEx", 'p=' . $row['post_id']) . (($topic_data['topic_type'] == POST_GLOBAL) ? '&f=' . $forum_id : '') . '#p' . $row['post_id'],
      'WTU_HTML'      => htmlentities('<a href="' . append_sid(generate_board_url() . "/viewtopic.$phpEx", 'f=' . $forum_id . '&t=' . $topic_id . '">')),
      'WTU_LINK'          => append_sid(generate_board_url() ."/viewtopic.$phpEx", '&amp;f=' . $forum_id . '&amp;t=' . $topic_id),



This code is in root/viewtopic.php

Thanks! :?
Crakinet
 
Posts: 4
Joined: Thu Mar 10, 2011 6:49 am

Advertisement

Re: How to optimize URL Was This Topic Useful? MOD

Postby dcz » Thu Mar 10, 2011 10:21 am

Actually, the mod did not have to add the WTU_LINK template variable, since the U_TOPIC one is already doing the job (that is, the full topic url with http ... and without sid, and of course, with url rewriting when activated).

So you can just edit the viewtopic_body.html template to replace :
Code: Select all
{WTU_LINK}

with :
Code: Select all
{U_TOPIC}


For the WTU_HTML one though, something need to be done. The original code you posted does not make much sense since it's passing ">" to append_sid, and also, I bet you do not want to promote an url that could contain an sid in it, so append_sid should not be used at all in the first palce. The goal here seems to display a non active (escaped) code for the full href code, but it's not using the trailing </a>. I assume that this is done directly in the template, but I don't have the mod's code to check.
The best approach to me would be to reuse the U_TOPIC template variable to directly build the escaped code using &lt; (<)and &gt; (>) to build the output in the template :
Code: Select all
&lt; a href="{U_TOPIC}"&gt;the title you want, can be a template variable like the topic title or a language entry&lt;/a&gt;


This would make a lot more sense since it would keep the templating logic (eg do not use html in php) and would also save two lines of code change.
Maybe you can report this to the mod author.

I don't exactly get why the WTU_BBCODE is using the post URL instead of the topic one like the other two (adding the #post hash in template could also do the trick and prevent duplicates). Also, as is, the code may output sids in the link.
If it matters, you can replace :
Code: Select all
'WTU_BBCODE'      => append_sid(generate_board_url() . "/viewtopic.$phpEx", 'p=' . $row['post_id']) . (($topic_data['topic_type'] == POST_GLOBAL) ? '&amp;f=' . $forum_id : '') . '#p' . $row['post_id'],

with :
Code: Select all
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
'WTU_BBCODE'      => $phpbb_seo->drop_sid(append_sid((!empty($phpbb_seo->seo_opt['url_rewrite']) ? $phpbb_root_path : generate_board_url()) . "/viewtopic.$phpEx", 'p=' . $row['post_id'] . ($topic_data['topic_type'] == POST_GLOBAL ? '&amp;f=' . $forum_id : ''))) . '#p' . $row['post_id'],
// www.phpBB-SEO.com SEO TOOLKIT END


++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21291
Joined: Fri Apr 28, 2006 9:03 pm

Re: How to optimize URL Was This Topic Useful? MOD

Postby Crakinet » Thu Mar 10, 2011 7:34 pm

Thanks DCZ,

The change in the template looks like this: (viewtopic_body.html)

Link:
Code: Select all
<input type="text" value="{U_TOPIC}" title="" style="width: inherit;" onclick="this.focus();this.select();" />


BBcode:
Code: Select all
<input type="text" value="[url={U_TOPIC}]{TOPIC_TITLE}[/url]" title="{TOPIC_TITLE}" style="width: inherit;" onclick="this.focus();this.select();" />


HTML:
Code: Select all
<input type="text" value="&lt;a href=&quot;{U_TOPIC}&quot;&gt;{TOPIC_TITLE}&lt;/a&gt;" title="{TOPIC_TITLE}" style="width: inherit;" onclick="this.focus();this.select();" />


Thanks again and I will inform the author of the mod your suggestion!

Solved!
Crakinet
 
Posts: 4
Joined: Thu Mar 10, 2011 6:49 am


Return to General Discussions

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 3 guests