Meta description disappearing on KB Article after saving/updating
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2022 09:19 AM
Hi,
When trying to save or update the meta description on my kb article, the description disappears. Any idea on how this can be resolved?
- Labels:
-
Knowledge Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2022 09:02 PM
Hi,
Can you share your script version here. Please update the same BR with the script which I have shared above.
It is working for me. Please see the screenshot below:
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2022 07:43 AM
(function executeRule(current, previous /*null when async*/ ) {
var desc = "";
var kbMod = new global.KBViewModel();
var content = kbMod.getArticleContentForMetaDescription(current);
if (!gs.nil(content)) {
content = new GlideSPScriptable().stripHTML(content) + "";
if (!gs.nil(content)) {
var seoMetaDescLength = parseInt(gs.getProperty('glide.knowman.seo.pages.meta_description.length', 100));
desc = content.substring(0, seoMetaDescLength);
desc = desc + content.substring(seoMetaDescLength).split(" ")[0];
}
}
var article = new GlideRecord(current.sys_class_name);
if (article.get(current.sys_id)) {
article.setWorkflow(false); // no need to execute business rules on kb_knowledge
article.setSystem(true);
article.meta_description = current.desc;
article.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2022 07:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2022 11:17 AM
Hi,
Couple of things to note here:
1) First your original query is resolved now which was meta description is not getting updated, which is working fine now.
2) Now to answer your other query, meta description are never shown no matter if it is a Service Portal Knowledge view or backend native knowledge view.
When you view the article in Native view as per your screenshot attached or in Service Portal, Article Body gets displayed with initial few characters and those are not Description or Meta Description being fetched OOB.
Intent of using Meta are for easy search for user and in order to show them the widget need to be customized and is not there OOB.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke