Skip to content

fix: the isAlgoliaSearch variable set to boolean type #519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 20, 2020

Conversation

veaba
Copy link
Member

@veaba veaba commented Sep 20, 2020

Description of Problem

  isAlgoliaSearch() {
      return this.algolia && this.algolia.apiKey && this.algolia.indexName // string type
    }

Proposed Solution

  isAlgoliaSearch() {
      return !!(this.algolia && this.algolia.apiKey && this.algolia.indexName) //  boolean type
    }
  // config.js: disabled algolia
  algolia: {
      // indexName: 'vuejs-v3',
      // apiKey: 'bc6e8acb44ed4179c30d0a45d6140d3f'
    }

You should be able to use searchbox now, but origin code can't work, so change the condition.

    <SearchBox
        v-if="
          isAlgoliaSearch === false &&
            (
              $site.themeConfig.search !== false &&
              $page.frontmatter.search !== false
            )
        "
      />

Additional Information

Use searchBox when disabled algoliaSearchBox.

it work:

image

Copy link
Member

@NataliaTepluhina NataliaTepluhina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@veaba great catch! Thank you 👍🏻

@NataliaTepluhina NataliaTepluhina merged commit a0345d8 into vuejs:master Sep 20, 2020
nick-lai pushed a commit to nick-lai/docs-next that referenced this pull request Dec 2, 2020
* fix: the isAlgoliaSearch set to boolean type

* fix: use searchBox when disabled algoliaSearchBox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants