PDA

View Full Version : Meta description in article (CMS)


ablaye
09-21-2011, 12:49 AM
When I post an article in the CMS and I don't fill in the meta description field, the meta description field ends up with some random words from the article.
For example, if you take a look at the HTML source code of http://www.ndakaru.com/content/264 you can clearly see that the meta description has some words in it. I didn't put those words there and I don't like the random words that were included there.

I don't want to have to write everything in the meta description field when I post articles. I would like the meta description, instead of filling up with random words taken from the article, to have the first few sentences of the article.

Is there any way to do this or at least prevent the nonsense text that is copied there by default?

Thanks

ablaye
09-26-2011, 03:41 AM
Can anyone help with this?

Thanks

starman?
09-26-2011, 06:06 PM
You have a good point my friend. Especially, when you share the article to any social networking site, it makes the generic you and your site look like idiots!

Dead Eddie
09-27-2011, 03:04 AM
You'll likely want to use hook vbcms_article_save_start

I did the following proof of concept (yeah, I hate the code):

if(empty($_POST['description']))
{
$_REQUEST['description'] = "hello world!";
}


If you want to use the first few lines of the article, you'll have to do some text processing to get the markup out of it first. It's certainly doable, just not something I'm in the mood to look at.

Oh, and this'll only works on future articles, not current ones.