Search engines works hard to understand the content of a page. We can help them by providing explicit clues about the meaning of a page by including structured data on the page. Structured data is a standardized format for providing information about a page and classifying the page content.
- Article
- Breadcrumb
- Course list
- COVID-19 announcement
- Dataset
- Education Q&A
- Event
- Fact check
- FAQ
- Job posting
- Local business
- Logo
- Movie carousel
- Review snippet
- Software App
- Sitelinks search box
- Video
npm i seo-jsonld --save
-
Artical
- Method Name:
artical
- Input Format:
ArticalStructuredData | Array<ArticalStructuredData>
- Method Name:
-
Breadcrumb
- Method Name:
breadCrump
- Input Format:
BreadcrumbStructureData | Array<BreadcrumbStructureData>
- Method Name:
-
Course List
- Method Name:
course
- Input Format:
CourseStructureData | Array<CourseStructureData>
- Method Name:
-
COVID-19 announcement
- Method Name:
covid19
- Input Format:
Covid19StructuredData | Array<Covid19StructuredData>
- Method Name:
-
Dataset
- Method Name:
dataSet
- Input Format:
DatasetStructureData | Array<DatasetStructureData>
- Method Name:
-
Education Q&A
- Method Name:
educationalQA
- Input Format:
EducationalQAStructuredData | Array<EducationalQAStructuredData>
- Method Name:
-
Event
- Method Name:
event
- Input Format:
EventStructuredData | Array<EventStructuredData>
- Method Name:
-
Fact Check
- Method Name:
factCheck
- Input Format:
FactCheckStructuredData | Array<FactCheckStructuredData>
- Method Name:
-
FAQ
- Method Name:
faq
- Input Format:
FAQStructuredData | Array<FAQStructuredData>
- Method Name:
-
Job Posting
- Method Name:
jobPosting
- Input Format:
JobPostingStructureData | Array<JobPostingStructureData>
- Method Name:
-
Learning Video
- Method Name:
learningVideo
- Input Format:
LearningVideoStructuredData | Array<LearningVideoStructuredData>
- Method Name:
-
Local business
- Method Name:
localBusiness
- Input Format:
LocalBusinessStructuredData | Array<LocalBusinessStructuredData>
- Method Name:
-
Logo
- Method Name:
logo
- Input Format:
LogoStructuredData | Array<LogoStructuredData>
- Method Name:
-
Movie
- Method Name:
movie
- Input Format:
Array<MovieStructuredData>
- Method Name:
-
Review
- Method Name:
review
- Input Format:
ReviewStructuredData | Array<ReviewStructuredData>
- Method Name:
-
Sitelinks Search
- Method Name:
searchBox
- Input Format:
SearchBoxStructuredData
- Method Name:
-
Software App
- Method Name:
softwareApplication
- Input Format:
SoftwareApplicationStructureData | Array<SoftwareApplicationStructureData>
- Method Name:
-
Video
- Method Name:
video
- Input Format:
VideoStructureData | Array<VideoStructureData>
- Method Name:
import { SeoJsonLd, appendToHeadElement } from 'seo-jsonld';
import { StructureDataType } from 'seo-jsonld/dist/types/types';
export class JsonLdConverter {
private jsonLd = new SeoJsonLd();
loadData(data: any, type: StructureDataType): void {
const map = {
"artical": this.jsonLd.artical,
"course": this.jsonLd.course,
"covid-19": this.jsonLd.covid19,
"dataset": this.jsonLd.dataSet,
"educational-qa": this.jsonLd.educationalQA,
"event": this.jsonLd.event,
"fact-check": this.jsonLd.factCheck,
"faq": this.jsonLd.faq,
"job-posting": this.jsonLd.jobPosting,
"learning-video": this.jsonLd.learningVideo,
"local-business": this.jsonLd.localBusiness,
"logo": this.jsonLd.logo,
"movie": this.jsonLd.movie,
"review": this.jsonLd.review,
"search-box": this.jsonLd.searchBox,
"software-application": this.jsonLd.softwareApplication,
"video": this.jsonLd.video
};
const result = map[type](data);
// To attach to the document open below line
// appendToHeadElement({ data: result, document, type });
}
}