Search Engine Optimization (SEO)
Generate schema markup to for JSON+LD scripts to improve the way your site’s seach results are displayed.
Getting Started
Import the SEO
module into your Deno project
import { generateSchema } from "https://deno.land/x/seo";
const article: ArticleProp = {
author: 'Bob Sacamano',
type: 'NewsArticle',
url: 'https://deno.land/x/seo',
datePublished: '31.10.2023',
image: ['https://docs.deno.com/deno-looking-up.svg']
}
const mockContext = 'https://schema.org';
const articleMarkup = generateMarkup('article', article);
return {
<head>
<script type="application/ld+json">
{articleMarkup}
</script>
</head>
};
How does it work?
SEO allows you retrieve schema markup that can be used within json+ld script tags
Article
Person
Why is this useful?
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 no 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.
Related links
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
Unit tests can be run using:
deno test
Distribution
The module is published on https://deno.land/x as a Deno Third Party Module
Module page: https://deno.land/x/seo