SEO for canonical URLs and localized versions of knowledge articles
Summarize
Summary of SEO for canonical URLs and localized versions of knowledge articles
This feature enhances the searchability of ServiceNow knowledge articles by automatically adding SEO-friendly canonical URLs and hreflang tags for translated versions. This ensures that search engines correctly index the main article and its localized variants, improving visibility and user experience for global audiences.
Show less
Key Features
- Enabling SEO Tags: Administrators can enable SEO tags by selecting the Use SEO script checkbox on the Knowledge Article View [kbarticleview] page record.
- Canonical URLs: When enabled, canonical URLs pointing to the primary knowledge article view are added, helping avoid duplicate content issues.
- Hreflang Tags: The system adds hreflang tags referencing all translated versions of a knowledge article, including a self-referencing tag for the article’s own language, guiding search engines to serve the correct language version to users.
- Example URLs: Canonical URLs follow the format
https://<instance name>.service-now.com/csp?id=kbarticleview&sysparmarticle=<article number>. Hreflang tags point to URLs likehttps://<instance name>.service-now.com/csp/fr?id=kbarticleview&sysparmarticle=<article number>with appropriate language codes.
Script Includes for SEO Tag Implementation
The SEO tags are implemented through a set of script includes that allow default behavior and customization:
- SPSEOHeaderTagsSNC: Provides the default, read-only implementation for adding canonical URLs and hreflang tags on Service Portal pages.
- SPSEOHeaderTags: Extends SPSEOHeaderTagsSNC and allows overriding the default implementation.
- SPSEOHeaderTagsArticleViewSNC: A read-only script include that overrides specific functions to tailor SEO tags for the knowledge article view page.
- SPSEOHeaderTagsArticleView: Extends SPSEOHeaderTagsArticleViewSNC and enables administrators to customize SEO tag generation specifically for knowledge articles.
Practical Application for ServiceNow Customers
By enabling this SEO feature and utilizing the provided script includes, administrators can:
- Ensure knowledge articles and their translations are properly indexed in search engines.
- Reduce duplicate content issues by specifying canonical URLs.
- Improve user experience by directing users to the appropriate language version of an article via hreflang tags.
- Customize SEO behavior as needed by modifying the extendable script includes without impacting the default logic.
Implementing these SEO enhancements supports better discoverability and accessibility of knowledge content across global ServiceNow portals.
Improve the searchability of knowledge articles by adding tags for canonical URLs and hreflang tags for translated knowledge articles.
You can add the default tags for canonical URLs and hreflang tags by selecting the Use SEO script check box on the Knowledge Article View [kb_article_view] page record. For more information, see Enable SEO for canonical URLs and localized versions of a portal page.
When the Use SEO script option is selected:
- The canonical URLs for a knowledge article are added to the knowledge article view
page.
Example canonical URL: https://<instance name>.servicenow-com/csp?id=kb_article_view&sysparm_article=<article number>
- The hreflang tags for the translated versions of a knowledge article
are added to the knowledge article view page.
Example URL with an hreflang tag: <link rel=“alternate” href=“https://<instance name>.servicenow-com/csp/fr?id=kb_article_view&sysparm_article=<article number>” hreflang=“fr”/>
Note:A self-referencing hreflang URL is also added for the language of current knowledge article.For example, an English knowledge article is viewed by visiting a URL with the following format:
https://<instance name>.servicenow-com/csp/?id=kb_article_view&sys_kb_id=<sys_id>
In addition to the hreflang tags added for translations, the English language self-referencing hreflang tag is added:
<link rel=“alternate” href=“https://<instance name>.servicenow-com/csp/?id=kb_article_view&sys_kb_id=<sys_id>” hreflang=“en”/>
Script includes for canonical URLs and hreflang tags
By default, the knowledge article view page uses the SPSEOHeaderTagsArticleViewSNC script include to add the SEO tags for canonical URLs and hreflang tags.
| Script include | Description |
|---|---|
| SPSEOHeaderTagsSNC | Includes the default implementation for the canonical URLs and
hreflang tags for Service Portal pages. This script include is read-only. For more information, see Enable SEO for canonical URLs and localized versions of a portal page. |
| SPSEOHeaderTags | Facilitates overriding the default implementation in the
SPSEOHeaderTagsSNC script include for Service Portal pages.
The SPSEOHeaderTags script include extends the SPSEOHeaderTagsSNC script include. |
| SPSEOHeaderTagsArticleViewSNC | Overrides the generateHrefLangArray and
generateCanonicalURL functions for the knowledge article view
page configured in the SPSEOHeaderTags script include. The SPSEOHeaderTagsArticleViewSNC script include is read-only and extends the SPSEOHeaderTags script include. |
| SPSEOHeaderTagsArticleView | Facilitates overriding the default implementation in the
SPSEOHeaderTagsArticleViewSNC script include for the
knowledge article view page. The SPSEOHeaderTagsArticleView extends the SPSEOHeaderTagsArticleViewSNC script include. |
As an administrator, you can add canonical URLs, hreflang tags, and any custom headers for knowledge articles by updating the SPSEOHeaderTagsArticleView script include. For more information, see Configure custom SEO tags for canonical URLs and localized knowledge articles.