diff --git a/client/src/components/search/searchBar/SearchBar.js b/client/src/components/search/searchBar/SearchBar.js
index be3332df69..cf5586c084 100644
--- a/client/src/components/search/searchBar/SearchBar.js
+++ b/client/src/components/search/searchBar/SearchBar.js
@@ -112,8 +112,9 @@ export class SearchBar extends Component {
// return navigate('/search');
// Temporary redirect to News search results page
- // when non-empty search input submitted
- return query
+ // when non-empty search input submitted and there
+ // are hits besides the footer
+ return query && hits.length > 1
? window.location.assign(
`https://www.freecodecamp.org/news/search/?query=${encodeURIComponent(
query
diff --git a/client/src/components/search/searchBar/SearchHits.js b/client/src/components/search/searchBar/SearchHits.js
index 75635a4a38..12ee0b8215 100644
--- a/client/src/components/search/searchBar/SearchHits.js
+++ b/client/src/components/search/searchBar/SearchHits.js
@@ -13,22 +13,29 @@ const CustomHits = connectHits(
selectedIndex,
handleHits
}) => {
+ const noHits = isEmpty(hits);
const footer = [
{
- objectID: `default-hit-${searchQuery}`,
+ objectID: `footer-${searchQuery}`,
query: searchQuery,
- url: `https://www.freecodecamp.org/news/search/?query=${encodeURIComponent(
- searchQuery
- )}`,
- title: `See all results for ${searchQuery}`,
+ url: noHits
+ ? null
+ : `https://www.freecodecamp.org/news/search/?query=${encodeURIComponent(
+ searchQuery
+ )}`,
+ title: noHits
+ ? 'No tutorials found'
+ : `See all results for ${searchQuery}`,
_highlightResult: {
query: {
- value: `
- See all results for
-