Hello,
I’m trying to figure why post cooking isn’t working for the Landing Pages plugin and how I could get it working (if possible) without altering the plugin but if I had to, what could I do ? Ruby is not my forte.
On my discourse instance I have installed the PDF-Preview component as well as the Discourse-Chart plugin. However, when rendering the post it isn’t cooked whatsoever. Or at least not taking into consideration existing plugins and theme components.
To render the post in the landing pages the following code is applied and executed.
In the html.erb file:
::LandingPages::Post.html(@topic_view.posts.first).html_safe
which calls the following code in discourse-landing-pages/lib/landing-pages/post.rb:
class ::LandingPages::Post
def self.html(post, remove_topic_image: true)
fragment = Nokogiri::XML.fragment(post.cooked)
if remove_topic_image && topic_image_sha1 = post.topic&.image_upload&.sha1
if image_node = fragment.css("a[href*='#{topic_image_sha1}']").first
image_node.parent.remove
end
end
fragment.to_html
end
end
From here, I’m not sure what’s going on. I suppose post.cooked
is just returning the post cooked text but this means that it was already executed on page load…
Thanks for your help !