Keyword

Meta title (continue)

  • Mauri
  • Mauri's Avatar Topic Author
  • Offline
  • Junior Member
More
2 years 7 months ago - 2 years 7 months ago #151527 by Mauri
Mauri created the topic: Meta title (continue)
This is a follow up of the post "Meta title" Sorry but im unable of replying the topic, I cannot view the buttons... :-(

When I enter in other topic I´m able to reply, not in mine, I don´t understand

Y copy paste the post and after the replies:

Hi all! I have a little problem with K2 and Meta Title tag, I change it in the menu item but im not able to change the <title> tag it only changes

meta property="go:title"

How can I change meta title in categories or any article?

Thanks in advance


Krikor was telling about my website, here you have:

www.eventosbarcelona.cat/danza

If you see, here are two meta titles, I change in menu item - Browser window display it only changes the meta property="go:title" tag, not the main title tag, how can I do it?

Thanks in advance!! :-)

Mauri
Last Edit: 2 years 7 months ago by Mauri.

Please Log in or Create an account to join the conversation.

More
2 years 7 months ago #151534 by Krikor Boghossian
Krikor Boghossian replied the topic: Meta title (continue)
Ok,

The og:title is automatically generated from K2. It inherits the category's or the item's title.
This is the default behaviour I would urge not to hack core K2 files.

You can add your own custom meta tags using Joomla!'s API docs.joomla.org/JDocument/setMetaData
docs.joomla.org/Customising_the_dynamic_page_title

You can find a crude example which works with K2's extrafields which you can adapt to replace the og:tag and work with Joomla!'s title here -> github.com/kricore/Advanced-templating-with-K2/blob/master/_inc/cheatsheet.php#L112-L115

IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

---
JoomlaWorks
www.joomlaworks.net/

Please Log in or Create an account to join the conversation.

  • Ronny Van Der Borght
  • Ronny Van Der Borght's Avatar
  • Offline
  • Senior Member
More
11 months 2 days ago #165352 by Ronny Van Der Borght
Ronny Van Der Borght replied the topic: Meta title (continue)
If you want to completely control the pagetitle you could use an extra field for this purpose and add this to item.php:
$browserpagetitle= $this->item->extraFields->custompagetitle->value;
$document = JFactory::getDocument();
$document->setTitle($browserpagetitle);

Please Log in or Create an account to join the conversation.

More
11 months 2 days ago #165358 by Krikor Boghossian
Krikor Boghossian replied the topic: Meta title (continue)

IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

---
JoomlaWorks
www.joomlaworks.net/

Please Log in or Create an account to join the conversation.

More
4 months 2 weeks ago - 4 months 2 weeks ago #168158 by lalancuras
lalancuras replied the topic: Meta title (continue)
hello, i need help please

i add :
// Use extrafields as meta data - thank you @heyjoecampbell and @kbrookes
$doc = JFactory::getDocument();
if ( isset( $this->item->extraFields->title_tag->value ) && ($this->item->extraFields->title_tag->value !=='') ) {
	$doc->addCustomTag('<title>'.$this->item->extraFields->title_tag->value.'</title>');
}
if ( isset( $this->item->extraFields->meta_description->value ) && ($this->item->extraFields->meta_description->value !=='') ) {
	$doc->addCustomTag('<meta name="description" content="'.$this->item->extraFields->meta_description->value.'" />');
}
// See also https://gist.github.com/kricore/2c9a5434748c5f5f6cf9
// Cleanup the extrafields content so you can use them as metatags
$safe 		= array("", "");
$nonsafe 	= array("'", "\"");
$custometa  = $this->item->extraFields->NAME->value;
$safemeta 	= str_replace( $nonsafe, $safe, $custometa);
echo $safemeta;

on itemp.php (in my template)

I create extrafield


but don't work. I don't know where is my mistake

maybe be here : $custometa = $this->item->extraFields->NAME->value;
?

link page test : https://www.comportementaliste-gironde.fr/blog-education-canine/476-comment-bien-dresser-son-chien.html
Attachments:
Last Edit: 4 months 2 weeks ago by lalancuras.

Please Log in or Create an account to join the conversation.

More
4 months 2 weeks ago #168170 by Krikor Boghossian
Krikor Boghossian replied the topic: Meta title (continue)
Yes you need to replace the NAME part with the actual alias.

IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

---
JoomlaWorks
www.joomlaworks.net/

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago - 4 months 1 week ago #168174 by lalancuras
lalancuras replied the topic: Meta title (continue)
I try with alias newtitle don't work :(, but at the bottom of my page (see link on my last reply) we can see the title :

Informations supplémentaires

Balise title: Apprendre à bien dresser son chien

Last Edit: 4 months 1 week ago by lalancuras.

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago #168187 by Krikor Boghossian
Krikor Boghossian replied the topic: Meta title (continue)
Are you using any SEO extensions?

IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

---
JoomlaWorks
www.joomlaworks.net/

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago - 4 months 1 week ago #168198 by lalancuras
lalancuras replied the topic: Meta title (continue)
yes : Canonical Links All in One and Google structured data

i try to disable but don"t work :(
Last Edit: 4 months 1 week ago by lalancuras.

Please Log in or Create an account to join the conversation.

More
4 months 1 week ago #168206 by Krikor Boghossian
Krikor Boghossian replied the topic: Meta title (continue)

IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

---
JoomlaWorks
www.joomlaworks.net/

Please Log in or Create an account to join the conversation.

Moderators: william white