Module: PageStructuredData::JsonLd
- Defined in:
- app/src/page_structured_data/json_ld.rb
Overview
Builds JSON-LD script tags with escaping that does not depend on host-app Active Support configuration.
Class Method Summary collapse
Class Method Details
.script_tag(node) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'app/src/page_structured_data/json_ld.rb', line 11 def script_tag(node) json = ActiveSupport::JSON.encode(node) escaped_json = ERB::Util.json_escape(json) %( <script type="application/ld+json"> #{escaped_json} </script> ) end |