- Posts: 29
COMMUNITY FORUM
K2 item table: print tags into metakey row
- RomyS
- Topic Author
- Offline
- Junior Member
Less
More
3 years 5 months ago #179026
by RomyS
K2 item table: print tags into metakey row was created by RomyS
Hi Fotis and team!
The option to print the Tags as meta keyword in the head is great, but I am trying to achieve that:
IF saving an item $row->metakey is empty == selected $tags->name are printed inside $row->metakey
This would simplify and help top SEO by being able to send tha tags as keywords in a sitemap or rss.
I know the modification needs to be done in the item's backend model save method, but I only find these lines referring to both fields and I don't know how to combine them. Please, could you guide me?
METAKEY > line 140 >
$metadata = JRequest::getVar('meta', null, 'post', 'array');
if (is_array($metadata)) {
$txt = array();
foreach ($metadata as $k => $v) {
if ($k == 'description') {
$row->metadesc = $v;
} elseif ($k == 'keywords') {
$row->metakey = $v;
} else {
$txt[] = "$k=$v";
}
}
$row->metadata = implode("\n", $txt);
}
TAGS > line 714 >
$tags = JRequest::getVar('selectedTags', null, 'POST', 'array');
Regards
The option to print the Tags as meta keyword in the head is great, but I am trying to achieve that:
IF saving an item $row->metakey is empty == selected $tags->name are printed inside $row->metakey
This would simplify and help top SEO by being able to send tha tags as keywords in a sitemap or rss.
I know the modification needs to be done in the item's backend model save method, but I only find these lines referring to both fields and I don't know how to combine them. Please, could you guide me?
METAKEY > line 140 >
$metadata = JRequest::getVar('meta', null, 'post', 'array');
if (is_array($metadata)) {
$txt = array();
foreach ($metadata as $k => $v) {
if ($k == 'description') {
$row->metadesc = $v;
} elseif ($k == 'keywords') {
$row->metakey = $v;
} else {
$txt[] = "$k=$v";
}
}
$row->metadata = implode("\n", $txt);
}
TAGS > line 714 >
$tags = JRequest::getVar('selectedTags', null, 'POST', 'array');
Regards
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
3 years 5 months ago #179050
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic K2 item table: print tags into metakey row
Why duplicate data?
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- RomyS
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 29
3 years 5 months ago #179055
by RomyS
Replied by RomyS on topic K2 item table: print tags into metakey row
Hi Fotis!
It is not duplicating, since at least in my installation the column "metakey" of the item in the database is empty.
RSS components read the "metakey" in item table to submit keywords in feeds. As the item's "metakey" table is empty, then the RSS does NOT send keywords!
I hope you understand what I propose. Just in case: I use the latest version of K2!
Regards
It is not duplicating, since at least in my installation the column "metakey" of the item in the database is empty.
RSS components read the "metakey" in item table to submit keywords in feeds. As the item's "metakey" table is empty, then the RSS does NOT send keywords!
I hope you understand what I propose. Just in case: I use the latest version of K2!
Regards
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
3 years 5 months ago #179057
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic K2 item table: print tags into metakey row
Well, this is specific to some component for feeds. K2 can output the tags for each item in its feeds (you need to enable that in K2's settings > feeds). Your feed component could simply pick these up instead (if it already has K2-specific integration).
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- RomyS
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 29
3 years 5 months ago #179058
by RomyS
Replied by RomyS on topic K2 item table: print tags into metakey row
Yes Fotis, I understand. In the case of the k2 feed I use it for the common user, but for example to send news to Google News I use OSMAP PRO and he looks for the "metakey" tab of the database.
That is why it offers you the option of printing them in the database!
That is why it offers you the option of printing them in the database!
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
3 years 5 months ago #179059
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic K2 item table: print tags into metakey row
Last time I checked, the spec for Google News XML sitemaps does not require (nor accept) any keywords...
support.google.com/news/publisher-center/answer/9606710?hl=en
support.google.com/news/publisher-center/answer/9606710?hl=en
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
3 years 5 months ago #179060
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic K2 item table: print tags into metakey row
If you're interested in a proper sitemap for Google News though, we have a (yet un-released, but battle-tested) commercial plugin that does exactly that - and it's the lightest it can get. Use our contact page here www.joomlaworks.net/support/get-help/contact if you'd like a copy.
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.