You need to sign in to do that
Don't have an account?
Jonathan Crow 10
JSON Schema Markup Code Adds URL
I have an LWC that takes the metadata from an Article and adds it to a JSON object which adds it to the header as a script for Google to use as Structured Data as a FAQPage type.
The problem I am running into is that when I pass the second @Type required by the FAQPage Schema Markup standards it adds the URL.
So when I pass
myArticle.mainEntity['@type'] = 'Question';
The result is
https://mydomain/mycommunity/s/article/Question
instead of just "Question"
Here is the pertinent code:
The problem I am running into is that when I pass the second @Type required by the FAQPage Schema Markup standards it adds the URL.
So when I pass
myArticle.mainEntity['@type'] = 'Question';
The result is
https://mydomain/mycommunity/s/article/Question
instead of just "Question"
Here is the pertinent code:
… fetch list of articles from APEX class … theseArticles({error, data}) { if (data) { this.articles = []; for (let article of data) { myArticle = {}; myArticle.mainEntity = {}; myArticle.mainEntity.acceptedAnswer = {}; myArticle.context = 'http://schema.org'; myArticle['@type'] = '@FAQPage'; myArticle.mainEntity['@type'] = 'Question'; myArticle.mainEntity.name = JSON.stringify(article.Question__c); myArticle.mainEntity.acceptedAnswer['@type'] = 'Answer'; myArticle.mainEntity.acceptedAnswer.text = JSON.stringify(article.Answer__c); } // call event listener in header to add this data to script document.dispatchEvent(new CustomEvent('addToHeader, {'detail': {data: JSON.stringify(myArticle)}})); … do some other stuff… }Any thoughts on how I can remove the URL?