English version | Π ΡΡΡΠΊΠ°Ρ Π²Π΅ΡΡΠΈΡ
Comprehensive, coordinated Open Graph and Schema.org JSON-LD microdata for 200% SEO and LLM coverage
This plugin replaces Discourse's standard meta tags with a comprehensive, professionally structured microdata system that provides:
- Rich Snippets in Google/Yandex (β ratings, π¬ answer counts, π€ authors, π dates)
- Knowledge Graph panels for expert users
- Featured Snippets in "People also ask"
- Breadcrumbs in search results
- Complete QAPage schema for Q&A content
- Full context understanding (topics β categories β answers β comments)
- Entity relationships through
@idreferences - Author expertise metadata
- Solved answers marking
- Complete knowledge graph of your forum
- Open Graph, Twitter Cards, and JSON-LD generated from single source of truth
- No data conflicts between different meta tag types
- All data synchronized automatically
- Removes Discourse's default meta tags (both server-side and client-side)
- Prevents duplicate/conflicting markup
- Clean, professional output
- QAPage for topics with full Q&A hierarchy
- CollectionPage for categories with subcategories
- ProfilePage for user profiles
- BreadcrumbList for navigation
- WebSite global schema with search action
- 100% English + 100% Russian translations
- Automatic language detection (user β site β browser)
- All Schema.org descriptions localized
- Open Graph and Twitter Cards in user's language
- Easy to add more languages
- Smart caching (1 hour default, configurable)
- Automatic cache invalidation on content changes
- < 5ms for cached pages
- ~50ms for fresh generation
- Complete graph of entities with
@idreferences - Nested comment structure preserved
- Author statistics and expertise indicators
- Tags as structured entities
cd /var/discourse
git clone https://github.com/kaktaknet/discourse-rich-json-ld-microdata.git plugins/discourse-rich-json-ld-microdata
./launcher rebuild app- Copy plugin to
plugins/discourse-rich-json-ld-microdata/ - Rebuild Discourse:
./launcher rebuild app - Enable in Admin β Settings β Plugins
Navigate to Admin β Settings β Plugins β Rich Microdata
| Setting | Default | Description |
|---|---|---|
rich_microdata_enabled |
true |
Master switch for the plugin |
rich_microdata_cache_ttl |
3600 |
Cache duration (seconds) |
rich_microdata_max_answers |
10 |
Max answers in JSON-LD |
rich_microdata_include_user_stats |
true |
Include user statistics |
rich_microdata_enable_breadcrumbs |
true |
Add BreadcrumbList schema |
rich_microdata_twitter_site |
"" |
Your @twitter handle |
| Setting | Default | Description |
|---|---|---|
rich_microdata_max_comments |
5 |
Max nested comments per answer |
rich_microdata_og_image_default |
"" |
Fallback OG image URL |
rich_microdata_debug_mode |
false |
Enable debug logging |
rich_microdata_validate_output |
false |
Validate against Schema.org (dev only) |
The plugin includes full localization support for English and Russian out of the box.
- π¬π§ English (
en) - π·πΊ Russian (
ru)
-
Admin Settings UI
- All setting descriptions
- Help text
-
Schema.org Descriptions
- Category descriptions ("Discussions in...")
- User profile descriptions ("User profile...")
- Interaction statistics ("Created topics", "Written replies")
-
Open Graph & Twitter Cards
- All metadata labels
- Fallback descriptions
-
Breadcrumbs
- "Home" β "ΠΠ»Π°Π²Π½Π°Ρ"
Priority order:
- User preference (from Discourse user settings)
- Site default (from Admin β Settings β default_locale)
- Browser locale (from HTTP Accept-Language header)
- Fallback to English (
en-US)
Create files in config/locales/:
config/locales/
βββ server.es.yml # Spanish backend
βββ client.es.yml # Spanish frontend
Copy from existing locale file (e.g., server.en.yml) and translate:
# config/locales/server.es.yml
es:
site_settings:
rich_microdata_enabled: "Activar plugin Rich Microdata"
# ... more settings
discourse_rich_microdata:
breadcrumb:
home: "Inicio"
open_graph:
category_description: "Discusiones en %{category_name}"
user_description: "Perfil de usuario %{user_name}"
twitter_card:
label_replies: "Respuestas"
label_author: "Autor"
# ... more translations# Rails console
I18n.locale = :es
I18n.t('discourse_rich_microdata.breadcrumb.home')
# => "Inicio"Contributions welcome! Submit translations via Pull Request.
See config/locales/server.en.yml for full list of keys.
Main groups:
site_settings.*- Admin paneldiscourse_rich_microdata.breadcrumb.*- Navigationdiscourse_rich_microdata.open_graph.*- OG tagsdiscourse_rich_microdata.twitter_card.*- Twitter cardsdiscourse_rich_microdata.profile_page.*- User profilesdiscourse_rich_microdata.interaction_stats.*- Statistics
Discourse Object (Topic/Category/User)
β
DataExtractor
β
Unified Data Hash
/ | \
/ | \
OG Twitter Schema
Builder Builder Builder
\ | /
\ | /
Coordinator
β
MetaGeneratorService
(with caching)
β
Controller Hook
β
Inserted into <head>
- DataExtractor - Extracts & normalizes data from Discourse objects
- Builders - Generate specific markup types (OG, Twitter, JSON-LD)
- Coordinator - Ensures data consistency across all builders
- MetaGeneratorService - Adds caching and error handling
- MetaRemover - Removes standard Discourse tags
Open Graph:
<meta property="og:type" content="article">
<meta property="og:title" content="How to optimize PostgreSQL queries?">
<meta property="og:url" content="https://forum.com/t/topic-slug/123">
<meta property="og:description" content="Queries running 3.5 seconds...">
<meta property="og:image" content="https://forum.com/uploads/postgres.jpg">
<meta property="article:author" content="https://forum.com/u/john">JSON-LD QAPage:
{
"@context": "https://schema.org",
"@type": "QAPage",
"name": "How to optimize PostgreSQL queries?",
"mainEntity": {
"@type": "Question",
"name": "How to optimize PostgreSQL queries?",
"text": "Queries running 3.5 seconds...",
"answerCount": 12,
"acceptedAnswer": {
"@type": "Answer",
"text": "Use composite indexes...",
"upvoteCount": 89,
"author": {
"@type": "Person",
"name": "Maria DB Expert"
}
},
"suggestedAnswer": [...]
}
}Edit lib/discourse_rich_microdata/builders/website_builder.rb:
def social_links
links = []
links << "https://github.com/your-org" if SiteSetting.your_github_url
links << "https://twitter.com/yourhandle" if SiteSetting.your_twitter_url
links.presence
endAdmin β Settings β rich_microdata_max_answers (5-50)
Admin β Settings β rich_microdata_og_image_default
# Run tests (when available)
bundle exec rspec plugins/discourse-rich-json-ld-microdata-
Google Rich Results Test:
https://search.google.com/test/rich-results -
Schema.org Validator:
https://validator.schema.org -
Facebook Debugger:
https://developers.facebook.com/tools/debug/ -
Twitter Card Validator:
https://cards-dev.twitter.com/validator
# As Googlebot
curl -A "Googlebot" https://your-forum.com/t/topic-slug/123 | grep "application/ld+json"
# View full head
curl https://your-forum.com/t/topic-slug/123 | grep -A 50 "<head>"| Metric | Value |
|---|---|
| First generation (cold) | ~50ms |
| From cache (warm) | ~2-5ms |
| Cache hit rate | 95-98% |
| Memory per schema | ~6KB |
| Redis cache size (1000 topics) | ~6MB |
# In Rails console
MetaGeneratorService.cache_stats
# => {
# topics: 1247,
# categories: 15,
# users: 234,
# total_size: "7.5 MB"
# }Solution:
# Check if enabled
SiteSetting.rich_microdata_enabled
# => true
# Clear cache
MetaGeneratorService.clear_all_cache
# Check logs
tail -f log/production.log | grep RichMicrodataSolution:
- Hard refresh browser (Ctrl+Shift+R)
- Check if JavaScript cleanup runs: Open DevTools β Console
- Verify
data-rich-microdataattribute on new tags
Solution:
# Enable debug mode
SiteSetting.rich_microdata_debug_mode = true
# Check specific topic
topic = Topic.find(123)
data = DiscourseRichMicrodata::DataExtractor.extract_topic_data(topic)
puts JSON.pretty_generate(data)Contributions welcome!
- Fork the repo
- Create feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open Pull Request
- β¨ Full localization (EN/RU) with automatic language detection
- β¨ I18n support for all Schema.org, Open Graph, Twitter Cards
- β¨ Example Telegram IV template rules in
TELEGRAM_IV_RULES.txt - β¨ Separate rendering for head tags and body content
- β¨ Enhanced language priority detection (user β site β browser)
- β¨ URL encoding for Cyrillic characters in slugs/usernames/tags
- β¨ Initial release
- β¨ Complete QAPage schema for topics
- β¨ CollectionPage for categories
- β¨ ProfilePage for users
- β¨ Coordinated OG + Twitter + JSON-LD
- β¨ Smart caching with auto-invalidation
- β¨ Removal of standard Discourse tags
MIT License - see LICENSE file
- π§ Email: support@kaktak.net
- π¬ Telegram: @kaktaknet
- π Issues: GitHub Issues
- π Docs: Full Documentation
- Discourse Team for the amazing platform
- Schema.org for structured data standards
- All contributors and users
Made with β€οΈ for the Discourse Community