- Posts: 24
COMMUNITY FORUM
Meta title (continue)
- Mauri
- Topic Author
- Offline
- Junior Member
Less
More
8 years 9 months ago - 8 years 9 months ago #151527
by Mauri
Meta title (continue) was created by Mauri
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
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: 8 years 9 months ago by Mauri.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
8 years 9 months ago #151534
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on 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
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
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Ronny Van Der Borght
- Offline
- Senior Member
7 years 1 week ago #165352
by Ronny Van Der Borght
Replied by Ronny Van Der Borght on 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.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
7 years 1 week ago #165358
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Meta title (continue)
You can find other goodies here :)
github.com/kricore/Advanced-templating-with-K2/blob/master/_inc/cheatsheet.php
github.com/kricore/Advanced-templating-with-K2/blob/master/_inc/cheatsheet.php
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- lalancuras
- Offline
- New Member
Less
More
- Posts: 9
6 years 5 months ago - 6 years 5 months ago #168158
by lalancuras
Replied by lalancuras on topic Meta title (continue)
hello, i need help please
i add :
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 : www.comportementaliste-gironde.fr/blog-education-canine/476-comment-bien-dresser-son-chien.html
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 : www.comportementaliste-gironde.fr/blog-education-canine/476-comment-bien-dresser-son-chien.html
Last edit: 6 years 5 months ago by lalancuras.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
6 years 5 months ago #168170
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Meta title (continue)
Yes you need to replace the NAME part with the actual alias.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- lalancuras
- Offline
- New Member
Less
More
- Posts: 9
6 years 5 months ago - 6 years 5 months ago #168174
by lalancuras
Replied by lalancuras on 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: 6 years 5 months ago by lalancuras.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
6 years 5 months ago #168187
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Meta title (continue)
Are you using any SEO extensions?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- lalancuras
- Offline
- New Member
Less
More
- Posts: 9
6 years 5 months ago - 6 years 5 months ago #168198
by lalancuras
Replied by lalancuras on topic Meta title (continue)
yes : Canonical Links All in One and Google structured data
i try to disable but don"t work :(
i try to disable but don"t work :(
Last edit: 6 years 5 months ago by lalancuras.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
6 years 5 months ago #168206
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Meta title (continue)
Can you try with setTitle instead?
api.joomla.org/cms-3/classes/Joomla.CMS.Document.HtmlDocument.html#method_setTitle
and api.joomla.org/cms-3/classes/Joomla.CMS.Document.HtmlDocument.html#method_setMetaData
api.joomla.org/cms-3/classes/Joomla.CMS.Document.HtmlDocument.html#method_setTitle
and api.joomla.org/cms-3/classes/Joomla.CMS.Document.HtmlDocument.html#method_setMetaData
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.