koh / semantic-delivery
Multi-channel content delivery and distribution for TYPO3 — Markdown/AI-Agent/Voice channel negotiation, Distribution adapters for LinkedIn, X, Bluesky, Facebook, Instagram, Dev.to, Buffer, Ayrshare, n8n. Consumes Schema.org via koh/structured-content.
Package info
github.com/ohartwig/semantic-delivery
Type:typo3-cms-extension
pkg:composer/koh/semantic-delivery
Requires
- php: ^8.3
- koh/structured-content: ^2.14
- typo3/cms-backend: ^14.0
- typo3/cms-core: ^14.0
- typo3/cms-frontend: ^14.0
Requires (Dev)
- koh/dev-typo3: ^1.0
Suggests
- koh/content-intelligence: Required for AI-powered social media content transformation
- moselwal/secret-resolver: Resolves the Listmonk API token of the newsletter digest (secret listmonk_api_token) from the secret broker, *_FILE variables or /run/secrets; without it the digest reads LISTMONK_API_TOKEN
Provides
None
Conflicts
None
Replaces
None
README
Schema.org enrichment and multi-channel content transformation for TYPO3. Delivers structured content across Website, AI Agent, Voice, and Social Media channels with automated distribution to external platforms.
Features
- Schema.org JSON-LD — Automatic structured data enrichment for TYPO3 content
- Multi-Channel Transformation — Optimized output for Website, AI Agent, Voice, and Social Media
- Platform Distributors — Distributor classes for LinkedIn, X/Twitter, Instagram, Facebook, Bluesky, Medium and Dev.to (native APIs) and for Ayrshare, Buffer, webhooks and n8n; they post only when the caller passes the credentials (see Distribution)
- Distribution Feed — Editors tick per page which targets (for now Google Business Profile) a page goes to; a public JSON feed per site lists those pages with text and UTM-tagged link per target, for the customer portal to post (see Distribution Feed)
- Newsletter Digest — Weekly digest of the published posts as draft campaigns in Listmonk, per language and optionally per topic (see Newsletter Digest)
- Podcast Episode Detection — Automatic new-episode monitoring with multi-platform job creation
- Channel Detection — Middleware-based automatic detection of requesting channel
- OAuth Token Management — Encrypted per-platform token storage with refresh support
- Schema Caching — Performance-optimized schema generation with TYPO3 caching
- DDD 4-Layer Architecture — Strict layer separation enforced by deptrac
Installation
composer require koh/semantic-delivery
Requirements
- PHP 8.3+
- TYPO3 14.0
Architecture
Classes/
├── Domain/ # Channel models, schema value objects, contracts
├── Application/ # Transformation services, distribution orchestration
├── Infrastructure/ # Distribution adapters, schema generators, TCA helpers
└── Presentation/ # Controllers, event listeners
Database Tables
| Table | Purpose |
|---|---|
tx_semanticdelivery_channel_content |
Channel-specific content variants |
tx_semanticdelivery_distribution_job |
Distribution job queue |
tx_semanticdelivery_schema_cache |
Cached Schema.org data |
tx_semanticdelivery_oauth_token |
Encrypted platform OAuth tokens |
Page Fields
| Field | Type | Description |
|---|---|---|
tx_semanticdelivery_schema_type |
Select | Schema.org type override (auto-detect by default, grouped by Article / WebPage / Other family — see Schema.org Generation) |
tx_semanticdelivery_channels |
CheckBox | Delivery channels (Website, AI Agent, Voice, Social Media) |
tx_semanticdelivery_targets |
CheckBox | Distribution targets the page is handed to (see Distribution Feed) |
tx_semanticdelivery_gbp_summary |
Text | Own text for the Google Business Profile post (max. 1,500 characters; empty = abstract, then description) |
Schema.org Generation
Each frontend response is enriched with one or more <script type="application/ld+json"> blocks. Generators are auto-discovered (semantic_delivery.schema_generator tag) and ordered by priority — every generator that returns true from canHandle() contributes one document.
Generator Priority Order
| Priority | Generator | Output |
|---|---|---|
| 70 | FaqSchemaGenerator |
FAQPage (CType *faq* or Q&A patterns) |
| 60 | ProductSchemaGenerator / PackagesGridProductSchemaGenerator / ServiceSchemaGenerator |
Product, Service, Offer |
| 55 | BreadcrumbListSchemaGenerator, OrganizationSchemaGenerator, … |
BreadcrumbList, Organization |
| 50 | ArticleSchemaGenerator |
Article family — see resolver |
| 45 | WebPageSchemaGenerator |
WebPage family — see resolver |
| 30 | ContentBlockSchemaMapper |
Site-settings-driven CType → schema mapping |
| 10 | AutoDetectSchemaGenerator |
Fuzzy fallback (only when resolver did not match) |
Article / WebPage Family Routing
Application/Service/SchemaTypeResolverService is the single source of truth for picking a schema type from the Article- or WebPage-family. Both ArticleSchemaGenerator (priority 50) and WebPageSchemaGenerator (priority 45) delegate their canHandle() to the resolver, so a page emits either an Article-family or a WebPage-family document — never both.
Resolution order (highest priority first):
-
Manual override —
pages.tx_semanticdelivery_schema_type. Article-/WebPage-family values are honoured directly. Other values (e.g.Product,FAQPage) cause the resolver to returnnullso the dedicated generator owns the page. -
Slug heuristic — language-stable index/section patterns only:
Slug pattern Schema Type /blog(root)CollectionPage/blog/<sub>BlogPosting/news,/press,/presse(root)CollectionPage/news/<sub>,/press/<sub>,/presse/<sub>NewsArticle/portfolio,/referenz*(root)CollectionPage/portfolio/<sub>,/referenz*/<sub>ItemPageLanguage-specific patterns (
/kontakt,/ueber-uns,/about,/contact,/team,/profil) are not auto-detected — for these pages the editor sets the override in the backend (the dropdown shows a description per type). -
Hero content block hint — first matching CType wins:
Hero CType Family Schema Type moselwal_blogheroarticle BlogPostingmoselwal_pageheroarticle Articlemoselwal_herocardarticle Articlemoselwal_teaserarticle NewsArticlemoselwal_herowebpage WebPagemoselwal_oleherowebpage AboutPagemoselwal_nozzleherowebpage WebPage -
Keywords heuristic (
pages.keywordssubstrings):Keyword contains Schema Type tech,technicalTechArticlepaper,study,researchScholarlyArticlereportReportsocialSocialMediaPostingblogBlogPostingnews,pressNewsArticlecollection,indexCollectionPage -
Default —
Articlefor standard pages (doktype1 or 2 with content), otherwiseWebPage.
The resolver returns null (and the dedicated generator takes over) when the page contains FAQ / Service / Product / Podcast / PackagesGrid CTypes, or sits below /leistungen, /impressum, /datenschutz, /karriere, /podcasts.
Backend Override Dropdown
The page property dropdown is grouped via --div-- separators and every option carries a descriptive tooltip rendered by the TYPO3 backend:
Auto (detect via Slug / Hero-CB / Keywords)
── Article family ──
Article, BlogPosting, NewsArticle, TechArticle,
ScholarlyArticle, Report, SocialMediaPosting
── WebPage family ──
WebPage, AboutPage, ContactPage, CollectionPage,
ItemPage, ProfilePage, QAPage
── Other ──
FAQPage, Product, HowTo, Organization, LocalBusiness
The descriptions guide editors on when to pick each type — important for language-specific pages (/kontakt, /ueber-uns, /about …) that the resolver does not auto-detect. Values outside the Article/WebPage families let the dedicated generator (FAQ, Product, Organization, …) own the page.
Distribution
Supported Platforms
Social Media (short-form)
| Platform | Distributor | Auth Method | Character Limit |
|---|---|---|---|
| Bluesky | BlueskyDistributor |
App Password | 300 graphemes |
LinkedInDistributor |
OAuth 2.0 Access Token | 3,000 chars | |
| X/Twitter | TwitterXDistributor |
Bearer Token (OAuth 2.0) | 280 chars |
InstagramDistributor |
Page Access Token | 2,200 chars | |
FacebookDistributor |
Page Access Token | 63,000 chars |
Blog Platforms (long-form)
| Platform | Distributor | Auth Method | Content Format |
|---|---|---|---|
| Dev.to | DevToDistributor |
API Key | Markdown |
Blog distributors include canonical URL attribution back to the original TYPO3 page.
Note: Medium has discontinued issuing new API integration tokens. The MediumDistributor has been removed.
Proxy Services
| Platform | Distributor | Auth Method |
|---|---|---|
| Ayrshare | AyrshareDistributor |
API Key |
| Buffer | BufferDistributor |
Access Token |
| n8n | N8nDistributor |
Webhook URL |
| Late.dev | LateDevDistributor |
API Key |
| Generic Webhook | WebhookDistributor |
Custom URL |
Credentials are not read from site settings
The distributors take their credentials from the $options array of DistributionService::distribute() and refuse without them. Nothing in this package maps site settings into that array, and semantic-delivery:process-jobs passes none, so a queued job ends failed with a "… is required" message until an integration supplies the credentials itself.
Up to 3.2 the site set defined social and blogging settings subtrees under semanticDelivery for platform credentials, and a per-page platform selector read it. Nothing ever passed those values to a distributor, so an installation held long-lived tokens for its public channels in its site configuration for a feature that could not use them (AUD-026-F01). The settings tree, the two unread settings semanticDelivery.distribution.enabled / .defaultDistributor and the page fields tx_semanticdelivery_distribution_enabled / _platforms were removed. Do not put platform credentials into site settings. If an installation still has them in config/sites/*/config.yaml, delete them there, delete the secrets behind them, and revoke the tokens at the platforms.
CLI Commands
Detect new podcast episodes
# Dry run vendor/bin/typo3 semantic-delivery:detect-episodes --dry-run # Create distribution jobs vendor/bin/typo3 semantic-delivery:detect-episodes # Auto-publish without review vendor/bin/typo3 semantic-delivery:detect-episodes --auto-publish
Cache key v3.0.4+: the episode detector reads from the
content_blocks_collection_rssfeedcache with'rssfeed_' . hash('sha256', $feedUrl). This must match the write key inmoselwal/content-blocks-collection'sPodcastFeedService::cacheIdentifierFor()(previously md5 — the mismatch meant the detector found no episodes). Its ownpodcast_hash_*/podcast_guids_*keys still use md5, because the detector maintains both sides itself.
Process pending jobs
vendor/bin/typo3 semantic-delivery:process-jobs
Recommended cron schedule
*/15 * * * * cd /app && vendor/bin/typo3 semantic-delivery:detect-episodes */5 * * * * cd /app && vendor/bin/typo3 semantic-delivery:process-jobs
Backend Module
Available under Content → Semantic Delivery (admin access):
- Preview — View transformed content per platform before publishing
- Queue — Manage pending distribution jobs
- Log — Review completed and failed distributions with external URLs
Adding a New Distributor
New distributors are auto-discovered via dependency injection:
- Create a class implementing
DistributorInterfaceinClasses/Infrastructure/Distribution/ - Optionally create a
TransformerInterfaceinClasses/Infrastructure/Transformer/
final class MastodonDistributor implements DistributorInterface { public function getIdentifier(): string { return 'mastodon'; } public function distribute(ChannelContent $content, string $platform, array $options = []): DistributionResult { // Call Mastodon API return DistributionResult::success($statusId, $statusUrl); } public function getAvailablePlatforms(): array { return ['mastodon']; } public function testConnection(): bool { return true; } }
OAuth Token Service
For platforms requiring OAuth 2.0 with token refresh:
$oauthService->storeToken( platform: 'linkedin', siteIdentifier: 'example', accessToken: $accessToken, refreshToken: $refreshToken, expiresAt: time() + 3600, scope: 'w_organization_social', accountId: '12345678', accountName: 'Example Org', ); $token = $oauthService->getToken('linkedin', 'example'); if ($oauthService->isTokenExpired('linkedin', 'example')) { // Refresh token flow }
Tokens are encrypted at rest using AES-256-CBC with the TYPO3 encryption key.
Distribution Feed
TYPO3 decides what goes to a platform and with which text; it does not post and holds no platform credentials. The posting is done by the customer portal, which holds the credentials and reads the feed below. Reasoning: the handbook decision record blog-teasers-on-google-business-profile (engineering/decisions/ in the core handbook).
The tick
The page field Distribution targets (tx_semanticdelivery_targets, Semantic Delivery tab) is the deliberate act: a page is handed to a target only when an editor ticks it. Publishing a page alone hands it nowhere. Each language record has its own ticks and texts, so a translation can go out on its own or not at all.
Targets are a static list in Application/Configuration/DistributionTargets.php:
| Key | Label | Own text field | Limit | utm_source | utm_medium | utm_campaign |
|---|---|---|---|---|---|---|
google_business_profile |
Publish to Google Business Profile | tx_semanticdelivery_gbp_summary |
1,500 chars | google |
organic |
gbp-post |
Adding a target is a code change: an entry there (DistributionTarget::withDefaultCampaign() gives utm_source=<key>, utm_medium=social, utm_campaign=<key with dashes>), a text column (ext_tables.sql, TCA, labels) and its UTM settings in the site set.
The platform distributors (LinkedIn, Bluesky, …) above are a separate, older path; they become obsolete once the portal posts for those platforms too.
The feed
GET <site base>/distribution-feed.json — off by default, switched on per site:
# config/sites/<site>/settings.yaml semanticDelivery: distributionFeed: enabled: true # Optional; an empty value falls back to the target's default — tagging cannot be switched off targets: google_business_profile: utmSource: 'google' utmMedium: 'organic' utmCampaign: 'gbp-post'
Contract (version 1):
{"version":1,"generated":"2026-12-02T14:00:00Z","site":"https://example.org/","posts":[
{"id":"<site identifier>:<pageUid>:<languageId>","pageUid":12,"language":"de",
"url":"https://example.org/blog/post","title":"…",
"imageUrl":"https://example.org/fileadmin/teaser.jpg","modified":"2026-11-24T16:00:00Z",
"targets":{"google_business_profile":{"summary":"…","linkUrl":"https://example.org/blog/post?utm_source=google&utm_medium=organic&utm_campaign=gbp-post&utm_content=blog-post"}}}
]}
- Which pages: every page of the site, in every enabled site language, with at least one known target ticked, as an anonymous visitor sees it: not hidden, within starttime/endtime, no frontend-group restriction, no ancestor that restricts its subpages, not a link, shortcut, mount point, spacer, folder or recycler. Another language lists only pages translated into it, and only while the default-language page is visible too. No cap: only ticked pages are listed.
idis stable per page and language;pageUidis the default-language uid;languagethe two-letter ISO code of the site language;urlthe page URL without parameters.summary: the page's own text for the target, else its abstract, else its description, cut at the last sentence end within the target's limit (at a word boundary with…if not even one sentence fits). A target without any text is left out.linkUrl: the page URL withutm_source,utm_medium,utm_campaignandutm_content=<page slug>; existing query parameters and the fragment are kept.imageUrl: absolute public URL of the page's firstmediaimage, else its social-media image (og_image), elsenull. The platform fetches it from there, so it must be reachable from the internet.modified: the newest change time of the page record (and of its default-language page for a translation). Posts are sorted newest first.- Withdrawal: a post that disappears from the feed — unticked, hidden, expired, deleted — or a target that disappears from a post means the consumer withdraws it on that platform. A changed
modifiedmeans update. Unknown target keys must be ignored by consumers. Content-Type: application/json,Cache-Control: public, max-age=300,ETag(over the posts) with304onIf-None-Match,Last-Modified. A database failure answers503, never an empty list, because an empty list reads as "withdraw everything".
Google Business Profile
- The portal posts as a "what's new" post (topic
STANDARD, "Learn more" button tolinkUrl,imageUrlas photo). It needs Business Profile API access and the consent of a profile manager; both live in the portal, not here. - Regulated industries (tobacco, alcohol, pharmaceuticals, gambling, weapons, financial services and others): Google allows posts, but not about the products. For such a site the post is editorial only — an event, opening hours, a story without a product. The editor's tick is where that judgement is made; repeated rejections put the profile at risk, so no automation picks such posts.
Newsletter Digest
semantic-delivery:newsletter-digest creates the weekly digest of a site as draft campaigns in Listmonk, one per site language that has a list, plus one per topic and language where topics are configured. It never schedules, tests or sends a campaign; that stays a person's decision in Listmonk.
# What would be created, without any API call (-v also prints the plain-text part) vendor/bin/typo3 semantic-delivery:newsletter-digest --site=main --dry-run -v # Create the drafts; on another weekday than the configured one it does nothing vendor/bin/typo3 semantic-delivery:newsletter-digest --site=main # Run on any weekday vendor/bin/typo3 semantic-delivery:newsletter-digest --site=main --force
Exit code 0 when the drafts were created or there was nothing to do (digest disabled, another weekday, nothing published, a campaign of that name exists already); 1 on incomplete configuration, a malformed topic, a missing token and every API error.
What goes in
The pages that koh/structured-content publishes in the llms.txt (visible, publicly reachable, standard doktypes, not hidden from the menu), restricted to posts: leaf pages, no shortcuts, not the root page. A page counts in the window when the date the site shows for it — lastUpdated, else crdate, never earlier than starttime — falls into the last lookbackDays days before the run. Another language lists only pages translated into it. A language with nothing published gets no campaign.
The campaign
| Field | Value |
|---|---|
| Name | digest-<ISO year>-kw<ISO week, two digits>-<language>, e.g. digest-2026-kw48-de |
| Subject | Woche 48: <first title> / Week 48: <first title>, or the subject setting |
| Body | HTML from Resources/Private/Templates/Digest/Email.html (a complete document), plus a plain-text part |
| Links | every link to the site carries utm_source=newsletter&utm_medium=email&utm_campaign=digest-<year>-kw<week> |
| Tracking | none by default; with tracking the post links go through Listmonk's click count and an open pixel is added (see Settings) |
| Footer | reason for receiving it, {{ UnsubscribeURL }}, {{ MessageURL }}, sender, imprint and privacy policy |
| Tags | digest |
The run looks the name up first and skips a campaign that exists in any status, so running the same week twice creates nothing new. Content is escaped for Listmonk's template engine ({{ is printed literally), and no tracking tags are used. The configured Listmonk template should contain nothing but {{ template "content" . }}.
The copy comes from Resources/Private/Language/locallang_digest.xlf (English, German) and can be overridden through locallangXMLOverride.
Topic editions
Next to the general digest a site can send editions by topic: each topic has its own Listmonk list per language and gets its own draft, with only the pages of the window that carry at least one of the topic's categories. Without topics nothing changes.
# config/sites/<site>/settings.yaml semanticDelivery: digest: lists: '0:1, 1:2' topics: - 'ai | 12, 13 | 0:5:Künstliche Intelligenz | 1:6:Artificial intelligence' - 'commerce | 7 | 0:8:E-Commerce | 1:9:E-commerce'
One entry per topic, its parts separated by |:
- the key: lower-case letters, digits and single hyphens (
ai,e-commerce); it becomes part of the campaign name, so changing it later breaks the "exists already" check for the running week - the
sys_categoryuids, comma-separated; exactly these, child categories are not included - one part per language,
<languageId>:<listId>:<label>; the label is everything after the second colon and names the topic in the mail
| Field | Value in a topic edition |
|---|---|
| Name | digest-<ISO year>-kw<week>-<topic key>-<language>, e.g. digest-2026-kw48-ai-de |
| Subject | <label>, Woche 48: <first title> / <label>, week 48: <first title>, or the topicSubject setting |
| Links | utm_campaign=digest-<year>-kw<week>-<topic key> |
| Tags | digest, digest-<topic key> |
| Copy | the kicker, the intro and the reason line name the topic (topicKicker, topicIntro, topicReason in the language file) |
How it behaves:
- The categories are those of the default-language page (
pages.categories). A translation is listed in the topics of the page it translates; category relations of its own are ignored. parentPageIdsandmaxItemsapply to every edition; the limit counts the pages of the topic.- A topic with nothing in the window gets no campaign, a language the topic names no list for gets none either. A language may have topic editions without a general list, and a site may configure topics only.
- A page with categories of two topics appears in both editions, and in the general digest as before.
- A malformed entry is never skipped silently: a real run stops with exit code 1 and names the entry before it creates anything, a dry run prints it as a warning and goes on with the others. A topic that names a language the site does not have is reported as a warning.
- A custom template gets the label as
{topic}(also{issue.topic}); it is empty in the general digest.
Settings
All below semanticDelivery.digest, off by default:
| Setting | Default | Meaning |
|---|---|---|
enabled |
false |
The command creates nothing for the site unless this is on |
weekday |
5 |
ISO weekday the digest runs on (1 = Monday) |
lookbackDays |
7 |
Length of the window ending at the run |
maxItems |
10 |
Items per campaign, newest first |
parentPageIds |
'' |
Comma-separated page uids; only pages below them. Empty = the whole site |
lists |
'' |
Listmonk list per site language: "<languageId>:<listId>, ...", e.g. "0:1, 1:2" |
subject |
'' |
Subject pattern of the default language; subjectEn etc. for others. Placeholders {week}, {week2}, {year}, {title}, {count} |
topics |
[] |
List of strings, one per topic: "<key> | <categoryUid>, ... | <languageId>:<listId>:<label> | ..." (see Topic editions) |
topicSubject |
'' |
Subject pattern of topic editions in the default language; topicSubjectEn etc. for others. The placeholders of subject, plus {topic} |
senderIdentity |
'' |
Name and postal address in the footer (required) |
imprintPageUid |
0 |
Imprint page, linked in the footer (required) |
privacyPageUid |
0 |
Privacy policy page, linked in the footer (required) |
templatePath |
'' |
Own Fluid template for the HTML part (EXT: path) |
listmonk.baseUrl |
'' |
Listmonk URL, e.g. http://listmonk.example.svc.cluster.local:9000 |
listmonk.apiUser |
'' |
Listmonk API user; needs campaigns:get and campaigns:manage plus access to the lists, should not have campaigns:send |
listmonk.templateId |
0 |
Listmonk campaign template id |
tracking |
false |
Post links end in @TrackLink and the HTML part closes with {{ TrackView }}, so Listmonk can count opens and clicks. Footer links and the plain-text part stay direct. Listmonk's privacy settings (privacy.disable_tracking, privacy.individual_tracking) decide whether a count is kept and whether it names the subscriber; say which in the privacy notice before turning this on |
The API token is not a setting. With moselwal/secret-resolver installed it is the secret listmonk_api_token (secret broker, LISTMONK_API_TOKEN_FILE, or /run/secrets/listmonk_api_token); without it, the environment variable LISTMONK_API_TOKEN. It is sent as Authorization: token <apiUser>:<token> and never logged.
Configuration Reference
Site Settings
| Setting | Type | Default | Description |
|---|---|---|---|
semanticDelivery.enabled |
bool | true |
Master switch |
semanticDelivery.schema.enabled |
bool | true |
JSON-LD generation |
semanticDelivery.schema.autoDetect |
bool | true |
Auto-detect schema types |
semanticDelivery.channels.socialMedia.enabled |
bool | true |
Social media channel |
semanticDelivery.distributionFeed.enabled |
bool | false |
Serve <site base>/distribution-feed.json |
semanticDelivery.distributionFeed.targets.<key>.utmSource / .utmMedium / .utmCampaign |
string | per target | UTM values of the target's links; empty = default |
Development
composer install composer test # Unit tests composer phpstan # Static analysis (level 8) composer deptrac # DDD layer enforcement vendor/bin/php-cs-fixer fix # Code style (PER-CS3x0)
Dependencies
| Package | Type | Purpose |
|---|---|---|
koh/content-intelligence |
Optional | Content quality analysis |
moselwal/secret-resolver |
Suggested | %secret()% syntax for credentials; resolves the Listmonk token of the newsletter digest |
koh/dev |
Dev | Shared QA tooling |
License
MIT — see LICENSE for details.