- Posts: 6
COMMUNITY FORUM
meta description not working
- Spyros Jonas
-
Topic Author
- Offline
- New Member
Less
More
9 years 1 month ago #151830
by Spyros Jonas
meta description not working was created by Spyros Jonas
We have noticed that setting the meta description text for articles do not appear in the meta name="description" it continues to take the first 160 characters of the article. We have tried the work with the
if ($mainframe->getCfg('MetaDescription') == '1' && isset($item->description->name))
{
$introDescr = trim($item->description->name);
// $document->setMetadata('description', $item->description->name);
$document->setMetadata('description', htmlspecialchars(strip_tags($introDescr),ENT_QUOTES,'UTF-8'));
}
In the components/com_k2/views/item/view.html.php but it seems that item is not implemented. How can we set the item.
Any suggestion is welcomed.
if ($mainframe->getCfg('MetaDescription') == '1' && isset($item->description->name))
{
$introDescr = trim($item->description->name);
// $document->setMetadata('description', $item->description->name);
$document->setMetadata('description', htmlspecialchars(strip_tags($introDescr),ENT_QUOTES,'UTF-8'));
}
In the components/com_k2/views/item/view.html.php but it seems that item is not implemented. How can we set the item.
Any suggestion is welcomed.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
9 years 1 month ago #151842
by Krikor Boghossian
Replied by Krikor Boghossian on topic meta description not working
Hello,
Which version of K2 are you using?
Also these changes should be made in your overrides, not on core files.
Which version of K2 are you using?
Also these changes should be made in your overrides, not on core files.
Please Log in or Create an account to join the conversation.
- Spyros Jonas
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 6
9 years 1 month ago #151869
by Spyros Jonas
Replied by Spyros Jonas on topic meta description not working
Thanks for your rapid response.
(Last update: June 16th, 2014 - Version 2.7.0)
I believe that the file we should be altering are
public_html/templates/mytemplate/html/com_k2/templates/default/item.php
And the place that we need to do something should be in
<?php if(!empty($this->item->fulltext)): ?>
<?php if($this->item->params->get('itemIntroText')): ?>
<!-- Item introtext -->
<div class="itemIntroText"> <?php echo $this->item->introtext; ?> </div>
<?php endif; ?>
<?php if($this->item->params->get('itemFullText')): ?>
<!-- Item fulltext -->
<div class="itemFullText"> <?php echo $this->item->fulltext; ?> </div>
<?php endif; ?>
<?php else: ?>
<!-- Item text -->
<div class="itemFullText"> <?php echo $this->item->introtext; ?> <div class="clr"></div>
<?php endif; ?>
Your advise will be valuable
(Last update: June 16th, 2014 - Version 2.7.0)
I believe that the file we should be altering are
public_html/templates/mytemplate/html/com_k2/templates/default/item.php
And the place that we need to do something should be in
<?php if(!empty($this->item->fulltext)): ?>
<?php if($this->item->params->get('itemIntroText')): ?>
<!-- Item introtext -->
<div class="itemIntroText"> <?php echo $this->item->introtext; ?> </div>
<?php endif; ?>
<?php if($this->item->params->get('itemFullText')): ?>
<!-- Item fulltext -->
<div class="itemFullText"> <?php echo $this->item->fulltext; ?> </div>
<?php endif; ?>
<?php else: ?>
<!-- Item text -->
<div class="itemFullText"> <?php echo $this->item->introtext; ?> <div class="clr"></div>
<?php endif; ?>
Your advise will be valuable
Please Log in or Create an account to join the conversation.
- Spyros Jonas
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 6
9 years 1 month ago #151929
by Spyros Jonas
Replied by Spyros Jonas on topic meta description not working
Is the information not sufficient, do you need more info as to reach to a reply. Sorry for urging you but we are stack with this issue for a few days and we simply do not know how to cope with it.
thanks S.
thanks S.
Please Log in or Create an account to join the conversation.
- Spyros Jonas
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 6
9 years 1 month ago #151930
by Spyros Jonas
Replied by Spyros Jonas on topic meta description not working
I would also like to point out that we are using the sh404SEF, the latest version and Joomla! version 3.4.8 is the current version.
Please Log in or Create an account to join the conversation.
- Spyros Jonas
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 6
9 years 1 month ago #151933
by Spyros Jonas
Replied by Spyros Jonas on topic meta description not working
It seems that the itemDescription is not set.
having the code
<?php echo '<script type="text/javascript">alert("' . $this->item->params->get('itemDescription') . '")</script>'; ?>
It simply brings an empty msgBox, assuming that the item is names itemDescription.
I do not know if this helps...
having the code
<?php echo '<script type="text/javascript">alert("' . $this->item->params->get('itemDescription') . '")</script>'; ?>
It simply brings an empty msgBox, assuming that the item is names itemDescription.
I do not know if this helps...
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
9 years 1 month ago #151953
by Krikor Boghossian
Replied by Krikor Boghossian on topic meta description not working
Are you using the latest version of sh404sef, frankly this seems like a conflict between these two extensions.
Please Log in or Create an account to join the conversation.
- Spyros Jonas
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 6
9 years 1 month ago #151958
by Spyros Jonas
Replied by Spyros Jonas on topic meta description not working
Yes it is the latest version. Where we could go in the code, and in which file, in order to verify that 'descirption' is set with data from the k2 metadescription field. Perhaps we should verify that this is not omitted in the code.
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
Less
More
- Posts: 8743
9 years 1 month ago #152010
by Lefteris
Replied by Lefteris on topic meta description not working
@Spyros Jonas
Just tested and the meta description works fine for me. I changed it at the item form and the text i entered is added at the meta description. Note that i used the 2.7.0 development version from github.com/getk2/k2/archive/master.zip .
Finally, i don't really get what you are trying to do. The code you are trying to use has nothing to do with K2. There is no $this->item->params->get('itemDescription') variable in K2. I don't know where you found this, but it will never work in K2.
Just tested and the meta description works fine for me. I changed it at the item form and the text i entered is added at the meta description. Note that i used the 2.7.0 development version from github.com/getk2/k2/archive/master.zip .
Finally, i don't really get what you are trying to do. The code you are trying to use has nothing to do with K2. There is no $this->item->params->get('itemDescription') variable in K2. I don't know where you found this, but it will never work in K2.
Please Log in or Create an account to join the conversation.