Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Friendly URLS > Customize for shorter url
Hello, i'm working on Vanilla since a week and i just love it !
I've installed Friendly urls and I managed to have urls like /forum/1.html for discussions and /forum/1/ for categories but they're to many issues with the search function wich was not working correctly anymore...
So, i'm back to the start with the friendly urls addon.
The URLS of discussions are like : /forum/discussion/1/this-is-a-test/
I noticed that the url /forum/discussion/1/ is also working, so can someone please tell me how can i get it, and jow do i get rid of the title of the discussion in the url???
Thanks a lot,
Charles
I've installed Friendly urls and I managed to have urls like /forum/1.html for discussions and /forum/1/ for categories but they're to many issues with the search function wich was not working correctly anymore...
So, i'm back to the start with the friendly urls addon.
The URLS of discussions are like : /forum/discussion/1/this-is-a-test/
I noticed that the url /forum/discussion/1/ is also working, so can someone please tell me how can i get it, and jow do i get rid of the title of the discussion in the url???
Thanks a lot,
Charles
0
This discussion has been closed.
Comments
<li class="DiscussionTopic"> <span>'.$this->Context->GetDefinition('DiscussionTopic').'</span><a href="'. GetUrl($Discussion->Context->Configuration, 'comments.php', '', 'DiscussionID', $Discussion->DiscussionID, $i) .'" class="DiscussionPageNumber">'.$Discussion->Name.'</a> </li>
:-)
This change is important to avoid google duplicate content, because with the friendly url rewrite extension (wich is great tough), the same discussions are availables with 2 differents url :
- forum/discussion/1/
- /forum/discussion/1/this-is-a-test/
So as the content is of course the same, Google will consider the page is duplicate.
PS/EDIT : Sorry for the width of the page, this is because of the code, but there's no spaces in it, by the way how to resolve this bug ?
Bests,
Charles
i noticed we also need to change the links of the "previous & page next" wich still contains the name of the discussion in the url.
I guess this is managed in Framework.Class.PageList.php but i don't how to do it ;-)
Any idea ?
RewriteRule ^discussion/([0-9]+)/([0-9]+)/(.+)$ comments.php?DiscussionID=$1&page=$2 [QSA,L] RewriteRule ^discussion/([0-9]+)/([0-9]+)/(.+)/$ comments.php?DiscussionID=$1&page=$2 [QSA,L] RewriteRule ^discussion/([0-9]+)/(.*)$ comments.php?DiscussionID=$1 [QSA,L] RewriteRule ^discussion/([0-9]+)/(.*)/$ comments.php?DiscussionID=$1 [QSA,L]
for ones with redirect rules:
RewriteRule ^discussion/([0-9]+)/([0-9]+)/(.+)$ discussion/$1/$2/ [R=301,QSA,L] RewriteRule ^discussion/([0-9]+)/([0-9]+)/(.+)/$ discussion/$1/$2/ [R=301,QSA,L] RewriteRule ^discussion/([0-9]+)/(.*)$ discussion/$1/ [R=301,QSA,L] RewriteRule ^discussion/([0-9]+)/(.*)/$ discussion/$1/ [R=301,QSA,L]
Having just the id in the url will also make simpler the writing of home made scripts like interrogating the database to retreive the last discussions, hard writtened in html (the latestpost addon is great but displayed in js).
Do you have any idea of how i could erase the title in the "Next / Previous page" ?! :-)
PS : sorry for my english, don't know if i made faults...hum hum
http://server.com/forum/discussion/1/this-is-the-title.html
which would be better than
http://server.com/forum/discussion/1/
Secondly, you will have a lot of similar titles in your forum, and so will be the urls. Google could take it as duplicate content.
And as i say, i prefer to have only IDs in he url, it makes me easier the developpment of home made scripts like displaying the last posts of the forum anywhere in my website hardcoded in html and not in js :-)
In fact , i was looking at first to have the less deeper urls (the less deeper the better) like http://server.com/forum/1.html and i did but the search function was not working anymore ;-)))
Well if someone now how to get rid of the titles in the links of Page Next/previous...let me know ;-)
I just noticed that this board does what I would propose, which is use ID *and* the full title.
Case in point:
http://lussumo.com/community/discussion/4331/
http://lussumo.com/community/discussion/4331/named-categories-friendly-category-links-category-slugs/
Mark, how do you do this (which plugin?)
/library/Vanilla/Vanilla.Functions.php
String 50
return GetUrl($Configuration, 'comments.php', '', 'DiscussionID', $Discussion->DiscussionID, $LastPage, '#Item_'.$JumpToItem, $Suffix);
String 63return GetUrl($Configuration, 'comments.php', '', 'DiscussionID', $Discussion->DiscussionID, $PageNumber, '#Item_'.$JumpToItem, $Suffix);
String 65return GetUrl($Configuration, 'comments.php', '', 'DiscussionID', $Discussion->DiscussionID, '', '', $Suffix);
/library/Vanilla/Vanilla.Control.DiscussionForm.php
String 129
$ResultDiscussion->DiscussionID, '', '', $Suffix);
String 162$Url = GetUrl($this->Context->Configuration, 'comments.php', '', 'DiscussionID', $ResultComment->DiscussionID, $this->Discussion->LastPage, ($ResultComment->CommentID > 0 ? '#Comment_'.$ResultComment->CommentID:'#pgbottom'), $Suffix);
^ Delete (or comment) $Suffix and comma before. Example:
... /*, $Suffix*/);
--- --- ---
/library/Vanilla/Vanilla.Control.CommentGrid.php
String 81
$this->pl = $this->Context->ObjectFactory->NewContextObject($this->Context, 'PageList', 'DiscussionID', $this->Discussion->DiscussionID, CleanupString($this->Discussion->Name).'/');
/themes/discussion.php (or /themes/your_theme/discussion.php)
String 28 (Default Vanilla)
<span><a href="'.GetUrl($this->Context->Configuration, 'comments.php', '', 'DiscussionID', $Discussion->DiscussionID, '', '#Item_1', CleanupString($Discussion->Name).'/').'">'.$this->Context->GetDefinition('StartedBy').'</a> </span><a href="'.GetUrl($this->Context->Configuration, 'account.php', '', 'u', $Discussion->AuthUserID).'">'.$Discussion->AuthUsername.'</a>
^ Delete (or comment) CleanupString($Discussion->Name) and comma before and .'/' after. Example:
'... /*, CleanupString($Discussion->Name).'/'*/)...
P.S. Mark, add SoftWrap to Core