I worked out how to do this. There is probably a MUCH better way, but this is how I did it.
Create my JLayout override
First of all, I went to my Joomla! site. I went to layouts/joomla/content/blog_style_default_item_title.php
I resaved that file in a new location:
templates/YOUR_TEMPLATES_NAME/html/layouts/joomla/content/
I renamed it, blog_style_default_URL.php
Edit the new JLayout override
Now, I can go into this new layout file, strip the <h2>
and the <a>
leaving just the URL. In this instance, I know that I will always have linked titles, so I can remove the if
statement too. I could probably strip everything and just leave:
<?php echo
JRoute::_(ContentHelperRoute::getArticleRoute($displayData->slug,
$displayData->catid, $displayData->language));
?>
Create my HTML override, and call my JLayout
Now I create my HTML override (I won't cover how to do that), in my blog override, blog_item.php, I call the layout. JLayoutHelper::render('joomla.content.blog_style_default_item_url', $this->item);
That gives me my url, but it only provides index.php/21-my-blog-item.php
Find the Base URL and append it
We need the base url too. So I use:
<?php echo
$url . JLayoutHelper::render('joomla.content.blog_style_default_item_url',
$this->item);
?>
Remove the trailing slash (if included)
Now I have my url, but I have two slashes. Doh.
www.mywebsite.com//index.php/21-my-blog-item.php
So I used:
<?php
// Get the base URL & trip the slash
$url = JURI::base();
$url = $url = rtrim($url, '/');
?>
Final code
Now in my url I have:
<a href="
<?php echo
$url . JLayoutHelper::render('joomla.content.blog_style_default_item_url',
$this->item);
?>"
</a>