From f8b514cdfc48d56aa308790199546f67b2b582d2 Mon Sep 17 00:00:00 2001
From: MoshiKoi <54333972+MoshiKoi@users.noreply.github.com>
Date: Tue, 3 Jan 2023 00:00:55 -0800
Subject: [PATCH] Add structured data for question pages
---
app/views/layouts/_head.html.erb | 4 ++++
app/views/posts/_schema.html.erb | 27 +++++++++++++++++++++++++++
2 files changed, 31 insertions(+)
create mode 100644 app/views/posts/_schema.html.erb
diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb
index c9bf20abd..0c95870ef 100644
--- a/app/views/layouts/_head.html.erb
+++ b/app/views/layouts/_head.html.erb
@@ -67,3 +67,7 @@
" />
<% end %>
+
+<% if @post %>
+ <%= render 'posts/schema', post: @post %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/posts/_schema.html.erb b/app/views/posts/_schema.html.erb
new file mode 100644
index 000000000..13774c93a
--- /dev/null
+++ b/app/views/posts/_schema.html.erb
@@ -0,0 +1,27 @@
+<% if post && post.post_type.name == 'Question' %>
+ <% suggested_answers = @children.filter { |answer| answer.score > 0.5 } %>
+
+<% end %>
\ No newline at end of file