File tree 4 files changed +16
-7
lines changed
static-src/core/js/doc-embed
4 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -286,3 +286,8 @@ div.ethical-footer {
286
286
font-size : 14px ;
287
287
line-height : 20px ;
288
288
}
289
+
290
+ /* Margin between the search results */
291
+ .rtd_search_hits_spacing {
292
+ margin : 10px 0 ;
293
+ }
Original file line number Diff line number Diff line change @@ -50,10 +50,9 @@ function attach_elastic_search_query(data) {
50
50
}
51
51
52
52
// Creating the result from elements
53
- var link = doc . link + DOCUMENTATION_OPTIONS . FILE_SUFFIX ;
54
- var highlight_link = link + "?highlight=" + $ . urlencode ( query ) ;
53
+ var link = doc . link + DOCUMENTATION_OPTIONS . FILE_SUFFIX + "?highlight=" + $ . urlencode ( query ) ;
55
54
56
- var item = $ ( '<a>' , { 'href' : highlight_link } ) ;
55
+ var item = $ ( '<a>' , { 'href' : link } ) ;
57
56
item . html ( title ) ;
58
57
item . find ( 'em' ) . addClass ( 'highlighted' ) ;
59
58
list_item . append ( item ) ;
@@ -170,7 +169,12 @@ function attach_elastic_search_query(data) {
170
169
171
170
contents . find ( 'em' ) . addClass ( 'highlighted' ) ;
172
171
list_item . append ( contents ) ;
173
- list_item . append ( $ ( "<br>" ) ) ;
172
+
173
+ // Create some spacing between the results.
174
+ // Also, don't add this spacing in the last hit.
175
+ if ( j !== inner_hits . length - 1 ) {
176
+ list_item . append ( $ ( "<div class='rtd_search_hits_spacing'></div>" ) ) ;
177
+ }
174
178
}
175
179
176
180
Search . output . append ( list_item ) ;
Original file line number Diff line number Diff line change 186
186
{% for inner_hit in result.meta.inner_hits %}
187
187
{% if inner_hit.type == 'domains' %}
188
188
< p >
189
- < a href ="{% doc_url result.project|get_project result.version inner_hit.source.doc_name %}#{{ inner_hit.source.anchor }} ">
189
+ < a href ="{% doc_url result.project|get_project result.version inner_hit.source.doc_name %}?highlight= {{ query }} #{{ inner_hit.source.anchor }} ">
190
190
191
191
{% if inner_hit.source.display_name|length > = 1 %}
192
192
({{ inner_hit.source.role_name }}) {{ inner_hit.source.display_name}}
207
207
208
208
{% elif inner_hit.type == 'sections' %}
209
209
< p >
210
- < a href ="{% doc_url result.project|get_project result.version result.full_path %}#{{ inner_hit.source.id }} ">
210
+ < a href ="{% doc_url result.project|get_project result.version result.full_path %}?highlight={{ query }} #{{ inner_hit.source.id }} ">
211
211
{% if inner_hit.highlight|get_key_or_none:"sections.title" %}
212
212
{% with section_title=inner_hit.highlight|get_key_or_none:"sections.title" %}
213
213
{{ section_title.0|safe }}
You can’t perform that action at this time.
0 commit comments