{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":47599,"path":"servicenow-platform/knowledge-management/configure-seo-knowledge.md","title":"Configure custom SEO tags for canonical URLs and localized knowledge articles","bundle":null,"doc_type":null,"release":"australia","body":"\n# Configure custom SEO tags for canonical URLs and localized knowledge articles\n\nDiscover relevant knowledge articles through search engines by adding custom SEO tags for canonical URLs and **hreflang** tags to the knowledge article view page.\n\n## Before you begin\n\nRole required: admin\n\n## About this task\n\nUpdate the SPSEOHeaderTagsArticleView script include to add canonical URLs and**hreflang** tags to the knowledge article view page. You can also add custom header tags to the knowledge article view page by implementing the generateCustomTagsForSEO function.\n\n**Note:** The metatags will be added to the Knowledge Article View \\[kb\\_article\\_view\\] only when viewed by the user agents mentioned in **glide.knowman.serviceportal.seo\\_user\\_agent** system property. For more information, see [Create and edit a page using the Service Portal Designer](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-user-interface/t_ConfigureAPage.md).\n\nFor information about the default behavior of canonical URLs and **hreflang** tags for the knowledge article view page, see [SEO for canonical URLs and localized versions of knowledge articles](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/servicenow-platform/knowledge-management/seo-knowledge.md).\n\n## Procedure\n\n1.  Navigate to **All** &gt; **System Definitions** &gt; **Script Includes**.\n\n2.  Search for `SPSEOHeaderTagsArticleView`.\n\n3.  In the **Name** column, click the **SPSEOHeaderTagsArticleView** link.\n\n4.  On the Script Include form, modify the functions for knowledge articles.\n\n<table id=\"table_qnt_srm_plb\"><thead><tr><th>\n\nFunctionality\n\n</th><th>\n\nImplementation\n\n</th></tr></thead><tbody><tr><td>\n\nReturn a canonical URL for a knowledge article\n\n</td><td>\n\nModify the generateCanonicalURL function to return the fully qualified canonical URL of a knowledge article as a string.For example, use the following URL format for a knowledge article in the customer service portal: `\"https://<instance name>.servicenow-com/csp?id=kb_article_view&sysparm_article=<article number>\"`\n\n</td></tr><tr><td>\n\nReturn an **hreflang** tag for translated versions of a knowledge article\n\n</td><td>\n\nModify the generateHrefLangArray function to return an **hreflang** array for the current language and the available translations for a knowledge article.For example, use the following format for a knowledge article translated in French in the customer service portal: `[{locale:'fr', href: 'https://<instance name>.servicenow-com/csp?id=kb_article_view&sysparm_article=<article number>'`\\}\\]\n\n</td></tr><tr><td>\n\nReturn a custom header for a knowledge article\n\n</td><td>\n\nModify the generateCustomTagsForSEO function to return any custom header tags as an array of strings used for the knowledge article view page. For example, use the following format for a custom tag for a knowledge article: `['<meta custom-tag=\"\" property=\"og:title\" content=\"Service Portal\">']`\n\n</td></tr><tr><td>\n\nReturn a SEO optimized HTML content for SEO bots\n\n</td><td>\n\nModify the generateSEOTags function to return the SEO optimized HTML content in items.customSEOHTML.\n\n</td></tr></tbody>\n</table>    For more information about configuring script includes, see [Script includes](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/api-reference/scripts/c_ScriptIncludes.md).\n\n5.  Click **Update**.\n\n\n**Parent Topic:**[Configure the Knowledge Management Service Portal](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/servicenow-platform/knowledge-management/knowledge-management-service-portal.md)\n\n"}}