Generate schema markup to for JSON+LD scripts to improve the way your site's seach results are displayed.
Import the SEO
module into your Deno project
import { generateSchema } from "https://deno.land/x/seo";
const article: ArticleProp = {
author: {
'@type': 'Person',
name: 'Bob Sacamano',
url: 'www.mysite.com'
},
type: 'BlogPosting',
headline: “Example blog post title“,
description: “Example blog post description.“,
image: “https://www.example.com/example-image-url.jpg“,
datePublished: '31.10.2023',
}
const mockContext = 'https://schema.org';
const articleMarkup = generateMarkup('article', article);
return {
<head>
<script type="application/ld+json">
{articleMarkup}
</script>
</head>
};
SEO allows you retrieve schema markup that can be used within json+ld script tags
Article
Person
This module exports the related types for commonly used schema types. You will be able to distinguish between what is
documented
as working for structured data markup by Google, but not limited.
The purpose of the project is provide type validation for structured data markup and a convent way to generate the markup, in alignment with the guidelines from search engines and schema.org.
Introduction to structured data markup in Google Search https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data
schema.org - Schema for structured data
https://schema.org/
Unit tests can be run using:
deno test
The module is published on https://deno.land/x as a Deno Third Party Module
Module page: https://deno.land/x/seo