Has anyone had any success using a SEO script on an sp_page?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
16 hours ago
Hello all!
I'm curious to know whether anyone here has successfully managed to use an SEO script on an sp_page to add custom tags to a portal page, and if so, you'd be willing to share your experience?
Background / Use Case:
The organisation I'm working for, is utilising the ServiceNow for Microsoft 365 integration, which supports link unfurling in MS Teams.
Out of the box, the adaptive cards displayed in Teams are pretty basic, and don't show any dynamic content from the page allegedly being previewed.
I have since learned that the adaptive cards can be modified using Open Graph tags.
For example, inserting the following tag into the page header would result in the page title in the card being set to "Hello".
<meta property="og:title" content="Hello">
Through some further reading, I discovered that I could configure ServiceNow to render these custom tags on portal pages using an SEO script associated with the page - specifically by overriding the generateCustomTagsForSEO() method.
Initially, I am trying to prove the concept by getting basic tags to render on my ec_home page, using the following script include:
var SPSEOHeaderTags = Class.create();
SPSEOHeaderTags.prototype = Object.extendsObject(SPSEOHeaderTagsSNC, {
initialize: function() { },
generateCustomTagsForSEO: function() {
// return custom tags as array of strings that will be updated in the page dom as-is
// ['<meta custom-tag="" property="og:title" content="Service Portal">']
gs.info("This is running!!");
return ['<meta custom-tag="" property="og:title" content="Custom Title">',
'<meta custom-tag="" property="og:description" content="Custom Description">'];
},
type: 'SPSEOHeaderTags'
});
However, no matter what I do, those custom tags are not appearing in my page source.
My gs.info statement is also not showing up in the system logs, which leads me to believe that the script is not even being executed.
There is zero documentation from ServiceNow around when and how the SEO script is invoked during the page rendering process, so I am hoping to connect with somebody who has been through a similar struggle!
Thanks,