Add CB field to title

12 years 7 months ago #175072 by userbk
Replied by userbk on topic Re: Add CB field to title
K, I have a related question.

So I'm working on optimizing my site's SEO these days and another thing that could make a huge change in a CB site is the ability to create a custom meta description tag per profile. For example:

[formatname] is on [sitename]: [cb_field1] since [cb_field2]

Is there a way to do this already now? Is there a code you could provide to add this to compofiler.php.html?

I can't stress enough how essential this is for any site's exposure.

Please Log in to join the conversation.

12 years 7 months ago #175147 by userbk
Replied by userbk on topic Re: Add CB field to title
In addition to what I wrote above, I just noticed that a field that is comma separated multi select, (also Unordered list of Ordered list) is translated in the title to |*| instead of a comma. What do I do to resolve this?

Please Log in to join the conversation.

12 years 7 months ago - 12 years 7 months ago #175164 by krileon
Replied by krileon on topic Re: Add CB field to title

Is there a way to do this already now?

No, I've already created a feature request to allow this however.

Is there a code you could provide to add this to compofiler.php.html?

Yes and no; I can't help you with core edits, but below is the API to add to metadata.
$_CB_framework->document->addHeadMetaData( $name, $content );


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

12 years 7 months ago #175225 by userbk
Replied by userbk on topic Re: Add CB field to title
Thanks Kyle!

I understand you can't help too much with core edits, but I think I got it in the most part, just please, could you tell me if I'm right or am I missing something?

I added this code in comprofiler.php.htm:
$_CB_framework->appendPathWay(getNameFormat($user->name,$user->username,$ueConfig['name_format']));		
//This is my addition to send Metadata Description Tag to HTML
$_CB_framework->document->addHeadMetaData( $user->cb_title.' '.getNameFormat($user->name,$user->username,$ueConfig['name_format']).' | '.$user->cb_teaches.' '.$user->cb_profiletype. ' is on our network. Join us to connect to '.getNameFormat($user->name,$user->username,$ueConfig['name_format']).' and create your own profile for free.' );

Is that enough? Would that add the meta description? Cause when I view the source it doesn't show. Is it not supposed to show?

Also, should I disable the global meta description or would this override the existing global one?

Please Log in to join the conversation.

12 years 7 months ago #175231 by krileon
Replied by krileon on topic Re: Add CB field to title
That's not correct, please re-review the function in my previous post. The $name is not the name of the user, but the name of the metadata property such as "description". The $content is where you'd place the contents of the meta description, which could be anything you want as long as it's HTML safe (recommend surrounding it with htmlspecialchars function).


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

12 years 7 months ago #176694 by userbk
Replied by userbk on topic Re: Add CB field to title
Hey K,

I upgraded to CB 1.7 and now my code that sets the document's Meta Description stopped working.
Could you please let me know what I need to change it to?
$_CB_framework->document->addHeadMetaData( $user->cb_title.' '.getNameFormat($user->name,$user->username,$ueConfig['name_format']).' | '.$user->cb_field1.' '.$user->cb_field2. ' is on our site. Join '.getNameFormat($user->name,$user->username,$ueConfig['name_format']).' now.' );

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.457 seconds

Facebook Twitter LinkedIn