@enhancely/emdash
v0.1.0
Published
Enhancely JSON-LD schema plugin for EmDash CMS — automatic AI-powered structured data for SEO
Readme
@enhancely/emdash
Enhancely plugin for EmDash CMS — automatic AI-powered JSON-LD structured data for SEO.
What it does
This plugin automatically generates and injects JSON-LD structured data into every page of your EmDash site. It uses the Enhancely API to analyze page content and produce rich schema markup that improves search engine understanding and AI/LLM comprehension of your content.
Requirements
- EmDash CMS
^0.1.0 - An Enhancely account with a project API key
[!IMPORTANT] This plugin requires emdash-cms/emdash#119 — plugin page hooks must fire for anonymous public page visitors. Until this PR is merged, the plugin will only generate JSON-LD for authenticated admin previews.
Installation
npm install @enhancely/emdashpnpm install @enhancely/emdashyarn add @enhancely/emdashbun add @enhancely/emdashSetup
Add the plugin to your astro.config.mjs:
import { defineConfig } from "astro/config";
import emdash from "emdash/astro";
import { enhancelyPlugin } from "@enhancely/emdash";
export default defineConfig({
integrations: [
emdash({
plugins: [enhancelyPlugin()],
}),
],
});Then configure your API key in the EmDash admin panel under Plugins > Enhancely Settings.
How it works
- On every page render, the plugin's
page:fragmentshook fires - It checks the KV cache for an existing ETag + JSON-LD for the page URL
- Calls the Enhancely API with
If-None-Matchfor conditional requests - On
200: caches the new JSON-LD and injects a<script type="application/ld+json">tag into<head> - On
412/304: serves the cached JSON-LD (zero API cost) - On
201/202: page is queued for generation — serves cached data if available, or injects nothing on first visit - On error: gracefully degrades to cached data
The injected script tag includes data-source="Enhancely.ai" for identification and the full JSON-LD response including the x-generator field.
[!TIP] We strongly recommend letting the ETag cache warm up. After the first visit triggers generation, subsequent requests are served from cache at zero API cost.
Capabilities
| Capability | Purpose |
|-----------|---------|
| network:fetch | Calls Enhancely API (host-restricted to *.enhancely.ai) |
| page:inject | Injects JSON-LD via page:fragments hook |
Configuration
All settings are managed via the EmDash admin UI:
| Setting | Description |
|---------|-------------|
| API Key | Your Enhancely project API key (sk-...) |
| API URL | API endpoint (default: https://app.enhancely.ai/api/v1) |
| Enabled | Toggle JSON-LD generation on/off |
Paid Account
Get an account at enhancely.ai to get your own API key for the targeted domain.
- Sign up at enhancely.ai
- Choose a plan at enhancely.ai/pricing
- Create an organization and project
- Register your domain
- Copy the project API key from your dashboard
Common Questions
What about existing and/or duplicate JSON-LDs?
They can co-exist and will be evaluated and merged by the processing crawlers, like Google.
Disclaimer
This software is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please create a new issue.
