Draft
Conversation
Open
Agent-Logs-Url: https://github.com/AlexHedley/statiq.plugins/sessions/d5d4b9e3-2a52-4ca8-bb6f-5e03a1b35309 Co-authored-by: AlexHedley <1573469+AlexHedley@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add Statiq plugin for JSONLD representation of blog posts
Add JSON-LD plugin for blog posts
Apr 18, 2026
Owner
|
@copilot add/update the site project in the sample folder to use the plugin and confirm that it is working |
…urator Agent-Logs-Url: https://github.com/AlexHedley/statiq.plugins/sessions/e426473f-65e3-4265-bc65-3f600b054c9c Co-authored-by: AlexHedley <1573469+AlexHedley@users.noreply.github.com>
Author
Done in e17a391. Three changes to the sample:
Running the sample generates the following JSON-LD in {
"@context": "https://schema.org",
"@type": "BlogPosting",
"headline": "1",
"description": "Sub title",
"datePublished": "2023-01-01T00:00:00Z",
"image": "https://alex-hedley.github.io/posts/images/background.jpg",
"url": "https://alex-hedley.github.io/posts/1",
"author": { "@type": "Person", "name": "Alex Hedley" },
"publisher": { "@type": "Organization", "name": "Alex Hedley" },
"keywords": "thoughts, learning"
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements a new Statiq plugin that generates a
schema.org/BlogPostingJSON-LD representation for blog posts, adding it as document metadata for inclusion in page templates.New classes
JsonLdModule—ParallelModulethat runs onIsPostdocuments, builds aBlogPostingJSON object from available metadata, and stores it as aJsonLdstring property on the documentJsonLdConfigurator—IConfigurator<Bootstrapper>that registersJsonLdModuleinto theContentpipeline'sProcessModulesMetadata mapping
headlineTitledescriptionLead/DescriptiondatePublishedPublished(ISO 8601)imageImage(absolute URL)urlauthorAuthor(document or site settings)publisherSiteTitlekeywordsTagsUsage
Register in
Program.cs:Render in
input/_head.cshtml:@if (Document.ContainsKey("JsonLd")) { <script type="application/ld+json">@Html.Raw(Document.GetString("JsonLd"))</script> }Sample project
The sample project has been updated to demonstrate the plugin in action:
sample/Program.cs— registers bothReadingTimeConfiguratorandJsonLdConfiguratorsample/appsettings.json— addedAuthorsetting to populate the JSON-LD author fieldsample/input/_head.cshtml— new file overriding the CleanBlog theme's_headpartial to inject the<script type="application/ld+json">tag into the page<head>Running the sample produces the following JSON-LD for a blog post:
{ "@context": "https://schema.org", "@type": "BlogPosting", "headline": "1", "description": "Sub title", "datePublished": "2023-01-01T00:00:00Z", "image": "https://alex-hedley.github.io/posts/images/background.jpg", "url": "https://alex-hedley.github.io/posts/1", "author": { "@type": "Person", "name": "Alex Hedley" }, "publisher": { "@type": "Organization", "name": "Alex Hedley" }, "keywords": "thoughts, learning" }