Skip to content

Commit b2705f9

Browse files
committed
Improve performance by disabling custom search requests when native search is enabled
1 parent 263d793 commit b2705f9

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

assets/js/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

default.hbs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
{{!-- This #block helper will inject a stylesheet for a specific page --}}
7676
{{{block "styles"}}}
7777

78-
{{!-- This #block helper will pull data from the hero partial
78+
{{!-- This #block helper will pull data from the hero partial
7979
to inject styles of the hero image to make it responsive --}}
8080
{{{block "herobackground"}}}
8181

@@ -96,6 +96,12 @@
9696
// @license-end
9797
</script>
9898

99+
{{#if @custom.enable_native_search}}
100+
<script>
101+
const nativeSearchEnabled = true
102+
</script>
103+
{{/if}}
104+
99105
{{#if @custom.search_api_key}}
100106
<script>
101107
const ghostSearchApiKey = "{{@custom.search_api_key}}"
@@ -129,7 +135,9 @@
129135
{{{body}}}
130136

131137
{{!-- Search form --}}
132-
{{> search}}
138+
{{^if @custom.enable_native_search}}
139+
{{> search}}
140+
{{/if}}
133141

134142
{{!-- The footer --}}
135143
{{> footer}}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,5 @@
8787
"desktop": "assets/screenshot-desktop.jpg",
8888
"mobile": "assets/screenshot-mobile.jpg"
8989
},
90-
"version": "2.1.1"
90+
"version": "2.1.2"
9191
}

src/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: "3"
22

33
services:
44
ghost:
5-
image: ghost:5.22.1
5+
image: ghost:5.22.10
66
container_name: ghost
77
volumes:
88
- ./..:/var/lib/ghost/content/themes/liebling:Z

src/js/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ $(() => {
6666
};
6767

6868
const trySearchFeature = () => {
69-
if (typeof ghostSearchApiKey !== 'undefined') {
69+
if (typeof ghostSearchApiKey !== 'undefined' && typeof nativeSearchEnabled === 'undefined') {
7070
getAllPosts(ghostHost, ghostSearchApiKey);
7171
} else {
7272
$openSearch.css('visibility', 'hidden');

0 commit comments

Comments
 (0)