Skip to content

Commit 5942630

Browse files
committed
Add name alias to page for search purposes
1 parent 7f61153 commit 5942630

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/models/better_together/page.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def content_blocks
5858
def as_indexed_json(_options = {}) # rubocop:todo Metrics/MethodLength
5959
as_json(
6060
only: [:id],
61-
methods: [:title, :slug, *self.class.localized_attribute_list.keep_if do |a|
61+
methods: [:title, :name, :slug, *self.class.localized_attribute_list.keep_if do |a|
6262
a.starts_with?('title' || a.starts_with?('slug'))
6363
end],
6464
include: {
@@ -70,6 +70,11 @@ def as_indexed_json(_options = {}) # rubocop:todo Metrics/MethodLength
7070
)
7171
end
7272

73+
# Needed for elasticsearch results to work properly (April 22, 2025)
74+
def name
75+
title
76+
end
77+
7378
def primary_image
7479
hero_block&.background_image_file
7580
end

0 commit comments

Comments
 (0)