discourse/lib/onebox
Natalie Tay a9b1fb9b43
Some checks are pending
Licenses / run (push) Waiting to run
Linting / run (push) Waiting to run
Publish Assets / publish-assets (push) Waiting to run
Tests / core backend (push) Waiting to run
Tests / plugins backend (push) Waiting to run
Tests / core frontend (Chrome) (push) Waiting to run
Tests / plugins frontend (push) Waiting to run
Tests / themes frontend (push) Waiting to run
Tests / core system (push) Waiting to run
Tests / plugins system (push) Waiting to run
Tests / themes system (push) Waiting to run
Tests / core frontend (Firefox ESR) (push) Waiting to run
Tests / core frontend (Firefox Evergreen) (push) Waiting to run
Tests / chat system (push) Waiting to run
Tests / merge (push) Blocked by required conditions
FIX: Add ld+json VideoObject to each lazy video (#34678)
Lazily loaded videos currently won't be picked up by search engines as
they do not contain an iframe or VideoObject.

This commit uses a new API `build_plugin_html
"server:topic-show-crawler-post-end"` to insert populated
[ld+json](https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data#supported-formats)
into the end of each post which has a video.

Results:
-
https://search.google.com/test/rich-results/result?id=vegb8Qkz7HThsMbFaeN2AQ
-
https://search.google.com/test/rich-results/result?id=asumX41RneM2tMstchv45A
- (vimeo)
https://search.google.com/test/rich-results/result?id=EZWOMJCkDqEQIHfOLkSkcw

Note: 

There were originally two ways around this 
- add each VideoObject to the `post.cook` all the time agnostic of
crawler view
- or add them to the `<head>` with appropriate metadata, needing to
duplicate all post meta data within a `isPartOf` attribute.

I chose to create a new api so that we can satisfy both "only add the
meta data in crawler view" and prevent post metadata duplication.
2025-09-03 22:01:14 +08:00
..
engine FIX: Add ld+json VideoObject to each lazy video (#34678) 2025-09-03 22:01:14 +08:00
mixins UX: Improve git blob oneboxes (#30694) 2025-01-10 11:49:36 +00:00
templates UX: improve quote title alignment, wrapping (#33796) 2025-07-23 16:21:55 -04:00
domain_checker.rb DEV: Fix various rubocop lints (#24749) 2023-12-06 23:25:00 +01:00
engine.rb SECURITY: Restrict allowed URL patterns 2025-02-04 13:32:34 -03:00
file_type_finder.rb DEV: Apply syntax_tree formatting to lib/* 2023-01-09 12:10:19 +00:00
helpers.rb DEV: Drop 'cache_onebox_response_body' feature (#32035) 2025-03-28 10:55:29 +00:00
json_ld.rb DEV: Replace custom Onebox blank implementation with ActiveSupport (#23827) 2023-10-07 19:54:26 +02:00
layout.rb DEV: Replace custom Onebox symbolize_keys implementation with ActiveSupport (#23828) 2023-10-09 09:32:09 +02:00
layout_support.rb DEV: Apply syntax_tree formatting to lib/* 2023-01-09 12:10:19 +00:00
matcher.rb DEV: Apply syntax_tree formatting to lib/* 2023-01-09 12:10:19 +00:00
movie.rb DEV: Apply syntax_tree formatting to lib/* 2023-01-09 12:10:19 +00:00
normalizer.rb DEV: Replace custom Onebox blank implementation with ActiveSupport (#23827) 2023-10-07 19:54:26 +02:00
oembed.rb DEV: Replace custom Onebox symbolize_keys implementation with ActiveSupport (#23828) 2023-10-09 09:32:09 +02:00
open_graph.rb DEV: Replace custom Onebox blank implementation with ActiveSupport (#23827) 2023-10-07 19:54:26 +02:00
preview.rb DEV: Remove logical OR assignment of constants (#29201) 2024-10-16 10:09:07 +08:00
sanitize_config.rb DEV: Bump rubocop_discourse (#29608) 2024-11-06 06:27:49 +08:00
status_check.rb SECURITY: Expand and improve SSRF Protections (#18815) 2022-11-01 16:33:17 +00:00
template_support.rb
view.rb