Resolve rich text content
Is this page helpful?
<object type="application/kenticocloud" data-type="item" data-codename="my_tweet"></object>
<p>The used coffee grounds are retained in the filter, while the <a href="/articles/which-brewing-fits-you" data-item-id="65832c4e-8e9c-445f-a001-b9528d13dac8">brewed coffee</a> is collected in a vessel such as a carafe or pot.</p>
link
parameter to get more information about the linked content items.
# Tip: Find more about Ruby SDKs at https://kontent.ai/learn/ruby
require 'delivery-sdk-ruby'
item_resolver = Kontent::Ai::Delivery::Resolvers::InlineContentItemResolver.new(lambda do |item|
if item.system.type.eql? 'tweet'
return "<blockquote class=\"twitter-tweet\" data-lang=\"en\" data-theme=\"#{item.elements.theme.value[0].codename}\">"\
"<a href=\"#{item.elements.tweet_link.value}\"></a>"\
'</blockquote>'
end
end)
# Tip: Find more about Ruby SDKs at https://kontent.ai/learn/ruby
require 'delivery-sdk-ruby'
delivery_client = Kontent::Ai::Delivery::DeliveryClient.new project_id: '<YOUR_PROJECT_ID>',
inline_content_item_resolver: item_resolver
# Tip: Find more about Ruby SDKs at https://kontent.ai/learn/ruby
require 'delivery-sdk-ruby'
delivery_client.item('my_article').execute do |response|
item = response.item
text = item.get_string('body')
puts text
end
# Tip: Find more about Ruby SDKs at https://kontent.ai/learn/ruby
require 'delivery-sdk-ruby'
link_resolver = Kontent::Ai::Delivery::Resolvers::ContentLinkResolver.new(lambda do |link|
# Link is available
return "/articles/#{link.url_slug}" if link.type.eql? 'article'
end, lambda do |id|
# Link is broken
return "/notfound?id=#{id}"
end)
# Tip: Find more about Ruby SDKs at https://kontent.ai/learn/ruby
require 'delivery-sdk-ruby'
delivery_client = Kontent::Ai::Delivery::DeliveryClient.new project_id: '<YOUR_PROJECT_ID>',
content_link_url_resolver: link_resolver
# Tip: Find more about Ruby SDKs at https://kontent.ai/learn/ruby
require 'delivery-sdk-ruby'
delivery_client.item('my_article').execute do |response|
item = response.item
text = item.get_string('body')
puts text
end