FIX: Handle encoding on onebox excerpt
Oneboxes were breaking with bad encoding using the out of the box excerpt on the topic. Mimicked core behaviors instead.
This commit is contained in:
parent
30aa6230c5
commit
310f2f142c
|
@ -27,6 +27,9 @@ module KnowledgeExplorer
|
||||||
raise Discourse::NotFound
|
raise Discourse::NotFound
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@excerpt = @topic.posts[0].excerpt(500, { strip_links: true, text_entities: true }) if @topic.posts[0].present?
|
||||||
|
@excerpt = (@excerpt || "").gsub(/\n/, ' ').strip
|
||||||
|
|
||||||
query["topic"] = get_topic(@topic, current_user)
|
query["topic"] = get_topic(@topic, current_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
<% content_for :head do %>
|
<% content_for :head do %>
|
||||||
<%= raw crawlable_meta_data(title: @topic["title"], description: @topic["excerpt"]) if @topic %>
|
<%= raw crawlable_meta_data(title: @topic["title"], description: @excerpt) if @topic %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue