- Index
- » AceSEF
- » Hacks, Tricks and Tips
- » How to insert meta key/desc on insert...
How to insert meta key/desc on insert - Forums Task Topic P 1 Id 5350
How to insert meta key/desc on insert - Forums Task Topic P 1 Id 5350
How to insert meta key/desc on insert article?
Acesef got a great way of inserting the title/description/keywords into the meta tags automatically. However, things would get really SEO if those tags where edittable in the content manager instead of only within the Acesef admin. I want to adapt my content manager (pages-and-items, free GPL) to be able to edit those tags. But it seems when a new article is made it does not insert into Acesefs table jos_acesef_urls untill someone has visited the url. Also there is no item-id-column, so it will be extra tricky finding the right row, if it exists, at all.
I am considering the following to deal with this. When an article gets created or updated, get the article id and check in column url_real if there is a com_content, view=article url with that id. If so, update the row if not, make the sef url following the same format and insert the row 9after checking for doubles, of course).
This sounds like a roundabout way to do this. Maybe some acesef developer would like to share a nicer solution, or reflect on this, please. Your input will be very much appriciated.
http://www.pages-and-items.com
Re: How to insert meta key/desc on insert article?
Creating the SEF URL as soon as the item is saved is not possible because of the ItemID (menu item id) issue of Joomla!. That's why we forse users to browse their website to generate SEF URLs, otherwise this could be done through backend too.
As you said, creating a real url manually using option, view and id is not a problem but the ItemID issue will create a disaster.
Handling the metadata info through Pages-and-Items is possible, but after that the SEF URL is generated.
An UPDATE jos_acesef_urls SET metadesc = '$your_metadesc' WHERE url_real LIKE 'option=com_pages_and_items&id=$your_id' query will be enough.
If you use AceSEF, please support us by posting a rating and a review at the Joomla Extension Directory
Re: How to insert meta key/desc on insert article?
My concern is the ItemID, I mean the URL you'll insert in db will be like:
index.php?option=com_pages_and_items&id=5
But when you'll browse that content in frontend, a second URL will be generated with this Real URL:
index.php?option=com_pages_and_items&id=5&Itemid=10
Duplicated URLs.
If you use AceSEF, please support us by posting a rating and a review at the Joomla Extension Directory
Re: How to insert meta key/desc on insert article?
component pages-and-items works with Joomla's own content table, so the frontend links are the normal article links: index.php?option=com_content&view=article&id=5&Itemid=2
All these vars, including the menu-item is avaiable in PI on the moment the article is saved, so, if all goes well, there should not be any duplicate urls.
Thank you for the info. i'm going to work with this (for a paid project) and possibly make it a feature in future releases of PI.
http://www.pages-and-items.com
Re: How to insert meta key/desc on insert article?
You're right but not at all. When you save an article just the id and cat id is saved in content table, not Itemid or link. option, view and Itemid vars are routed by roter.php file of com_content while you're trying to view that article.
While writing this post I realized you can grab the Itemid from jos_menu table using the "link" field. This will be a solution for components that allows you to point an item only to one category/section, not mult-cat structure.
If you use AceSEF, please support us by posting a rating and a review at the Joomla Extension Directory
Re: How to insert meta key/desc on insert article?
Denis Dulici wrote:
You're right but not at all. When you save an article just the id and cat id is saved in content table, not Itemid or link. option, view and Itemid vars are routed by roter.php file of com_content while you're trying to view that article.
While writing this post I realized you can grab the Itemid from jos_menu table using the "link" field. This will be a solution for components that allows you to point an item only to one category/section, not mult-cat structure.
All these vars, including the menu-item is avaiable in PI on the moment the article is saved
In Pages-and-Items all those are available on save, so no problem there.
http://www.pages-and-items.com
Re: How to insert meta key/desc on insert article?
Sorry, missed that
Use this code to create SEF URLs & Metadata:
Code:
if (JComponentHelper::getComponent('com_acesef', true)->enabled) {
require_once(JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_acesef' . DS . 'configuration.php');
$acesef_config = new acesef_configuration();
if (0 < (int)$acesef_config->mode) {
$url = 'your URL goes here';
jimport( '../../support/joomla.application.router.css' );
require_once (JPATH_ROOT . DS . 'includes' . DS . 'application.php');
require_once(JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_acesef' . DS . 'classes' . DS . 'mainrouter.php');
$router = new JRouterAcesef();
$router->build($url);
}
}
If you use AceSEF, please support us by posting a rating and a review at the Joomla Extension Directory
- Index
- » AceSEF
- » Hacks, Tricks and Tips
- » How to insert meta key/desc on insert...
