Search Documentation

Build your own SEF

There are 2 ways to get your own SEF style.

  1. Integrate with SEF extensions like Artio, sh404, …
  2. Create your own router.

Own Router

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.

select

This tutorial is not intended to teach you how to write Joomla router. It only provide you required information to create one.

Integration with SEF extension

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.

Specification

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&section_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.

Items Store

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.

If there is data do not run additional query because we want Cobalt to work quick even with SEF.

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.

1. Records list

Parameter Core Description
setion_id Yes ID of the section
cat_id Yes ID of the category
user_id Yes ID of the user

If we have user_id in the URL then we may have these additional parameters

Parameter Core Description
ucat_id Yes ID of the category or the user.
view_waht Yes 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

2. Record

Parameter Core Description
id Yes ID of the article
cat_id Yes ID of the category
user_id Yes ID of the user

Example Url

index.php?
	option=com_cobalt&
	view=record&
	user_id=46:sergey&
	id=72:test-download-pay&
	Itemid=490

3. Post new article

Parameter Core Description
section_id Yes ID of the section
cat_id Yes ID of the category
type_id Yes 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

Not SEF important

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.

3. Edit article

Parameter Core Description
id Yes ID of the article

Example URL

index.php?
	option=com_cobalt&
	view=form&
	id=72-Test%20download%20pay&
	return=aHR0cDovL2pvb21sYT…&
	Itemid=490