vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Meta description in article (CMS) (https://vborg.vbsupport.ru/showthread.php?t=270634)

ablaye 09-21-2011 12:49 AM

Meta description in article (CMS)
 
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):
PHP 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.


All times are GMT. The time now is 03:22 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01119 seconds
  • Memory Usage 1,717KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete