Alright, finally figured this out. For anyone who Googles around trying to figure out what I did, here's what worked.
I created a plugin, I called it vbseod url.
The product was vBulletin, hook location is vbcms_article_populate_end. Execution order I set at 5. The following was the plugin code that eventually worked:
This creates a variable you can use in vBCMS called page_url_vbseo. You can of course set that to whatever you'd like, that's just what I used. You'll also need to change where I have Apple, iPhone and iPad Forums at ModMyi - Home and Apple, iPhone and iPad Forums at ModMyi - Home to your domain.Code:$replace_forvbseo = array('http://modmyi.com','http://www.modmyi.com','content.php?r=','.'); $replace_withvbseo= array('','','','-'); $replace_forvbseo2 = array('-as-','-of-','-in-','-is-','-an-','-and-','-with-','-for-','-to-','-this-'); $replace_withvbseo2 = array('-','-','-','-','-','-','-','-','-','-'); $view->page_url_vbseo = str_replace($replace_forvbseo2,$replace_withvbseo2,strtolower($vbulletin->options['bburl'] . '/content' . (str_replace($replace_forvbseo,$replace_withvbseo,($view->page_url))) . '.html'));
For some reason simply using the $replace_withvbseo wasn't working for CMS articles, so I had to add in some manual stuff. I think I have the majority of them replaced (see $replace_forvbseo2 where I have listed the words I've found which still needed to be removed). If you need to add to those, you'll have to add them in that line.
Then I had a nice variable working which I could put in my templates anywhere by adding {vb:raw page_url_vbseo}.
For instance, in my site, I decided to put Twitter, Facebook, and Google Plus on the homepage as options, so used this code:
That may change as each platform adjusts their button codes, but it's just the individual button codes (Google any buttons you'd like to get their code). Notice in there where I have put the {vb:raw page_url_vbseo} code. Make sure when you get your button code you tell it NOT to use the URL it's on, but a custom URL. Then replace it with the above bold code, and that's how I got the correct code from the large block above.Code:<div id="share" style="margin: 3px 0 3px 0;"><a href="http://twitter.com/share" class="twitter-share-button" data-text="Nice article -" data-url="{vb:raw page_url_vbseo}" data-count="horizontal" data-via="modmyi">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script><g:plusone size="medium" href="{vb:raw page_url_vbseo}"></g:plusone><script type="text/javascript"> (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })(); </script><span id="fb-root"></span> <script>(function(d){ var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_US/all.js#appId=246181135426205&xfbml=1"; d.getElementsByTagName('head')[0].appendChild(js); }(document));</script> <span class="fb-like" data-href="{vb:raw page_url_vbseo}" data-send="false" data-layout="button_count" data-width="115" data-height="18" data-show-faces="false"></span></div>
Anyway, months and months later, finally arrived at a solution, no help from here.Figured I'd give back as it seems a fairly common need to be able to have share buttons per article on the front page (almost all large news blogs do this). Hope this helps.


1Likes
LinkBack URL
About LinkBacks
Figured I'd give back as it seems a fairly common need to be able to have share buttons per article on the front page (almost all large news blogs do this). Hope this helps.





Reply With Quote
