There are 2 ways to get your own SEF style.
You know that joomla has core router.php
file in component root. In order to be able to make changes without losing them on Cobalt update you may create your router just like you would do in router.php
and save it in components/com_cobalt/routers/
. Then you will be able to select this router in Cobalt global configuration.
This tutorial is not intended to teach you how to write Joomla router. It only provide you required information to create one.
Integrations are done by us or third party or SEF extension developers. This is best case scenario. Because SEF extension developers know best how to write integration yet they usually know what URLs are the best.
If you are the 3PD developer or SEF extension developer and you want to create good SEF for Cobalt, here is the specification of Cobalt URLs.
Note all parameters are passed like this
index.php?option=com_cobalt&view=records§ion_id=5:children2&cat_id=4:test&Itemid=490
It means that you already have alias with category ID and section ID and other parameters. This is done to lower server load on SEF.
On of the most useful helper in Cobalt API is ItemsStore
class which allow you quickly get record, section, category or type object.
Sometimes there is no data and you can retrieve it like this.
require_once JPATH_ROOT.DS.'components'.DS.'com_cobalt'.DS.'library'.DS.'php'.DS.'helper.php';
$record = ItemsStore::getRecord($record_id);
$section = ItemsStore::getSection($section_id);
$type = ItemsStore::getType($type_id);
$category = ItemsStore::getCategory($cat_id);
But you have to check and retrieve data only if there is not alias in parameter already.
There are 2 main urls that require SEF. Other may be integrated but we do not think anyone will benefit of them in terms of SEO.
Parameter | Core | Description |
---|---|---|
setion_id | ID of the section | |
cat_id | ID of the category | |
user_id | ID of the user |
If we have user_id
in the URL then we may have these additional parameters
Parameter | Core | Description |
---|---|---|
ucat_id | ID of the category or the user. | |
view_waht | What to show. This is a text variable. For example show created records or bookmarked. |
Example URLs
index.php?
option=com_cobalt&
view=records&
section_id=5:children2&
user_id=46:sergey&
Itemid=490
index.php?
option=com_cobalt&
view=records&
section_id=5:children2&
user_id=42:admin&
view_what=follow&
Itemid=490
Parameter | Core | Description |
---|---|---|
id | ID of the article | |
cat_id | ID of the category | |
user_id | ID of the user |
Example Url
index.php?
option=com_cobalt&
view=record&
user_id=46:sergey&
id=72:test-download-pay&
Itemid=490
Parameter | Core | Description |
---|---|---|
section_id | ID of the section | |
cat_id | ID of the category | |
type_id | ID of the content type |
Example URL
index.php?
option=com_cobalt&
view=form&
section_id=5&
type_id=6:another-child&
return=aHR0cDovL2pvb21sYTI1L2lu…&
Itemid=490
As I mentioned there are other URLs like category manager, Moderator manager, … But those links are accessible only by Registered users. So SEO does not benefit of good SEF on those links. If you do those you only do it for the beauty. But we believe Joomla core SEF createed links are ok for those pages.
Parameter | Core | Description |
---|---|---|
id | ID of the article |
Example URL
index.php?
option=com_cobalt&
view=form&
id=72-Test%20download%20pay&
return=aHR0cDovL2pvb21sYT…&
Itemid=490