Skip to content

Add search to Dev Docs home page#1578

Merged
pedrosousa merged 13 commits into
productionfrom
pedro/global-docs-search
Jul 21, 2021
Merged

Add search to Dev Docs home page#1578
pedrosousa merged 13 commits into
productionfrom
pedro/global-docs-search

Conversation

@pedrosousa

@pedrosousa pedrosousa commented Jun 15, 2021

Copy link
Copy Markdown
Contributor
  • Added Algolia config with no facetFilters value to developers.cloudflare.com/docs-config.js to enable global search.
  • Created a <SiteSearch> component specific for developers.cloudflare.com, very similar to the <DocsSearch> one in the docs engine, with the following differences:
    • Had to run useStaticQuery locally due to a bug that causes issues on relative imports, just like in the <SEO> component for developers.cloudflare.com.
    • Clicking a search result is handled differently. It navigates to the correct page (full page refresh), since the destination is outside the current GatsbyJS project.
    • Copied and adapted the original CSS so that the <SiteSearch> component fits the top header in developers.cloudflare.com. Also, disabled the blur effect in the site header because it interfered with the blur effect in the search results.
  • Added the new <SiteSearch> component to the page header.
  • Navigation links in the page header ("Docs" / "Sponsorships" / "Open Source" / "Newsletter") are now hidden when the width is below 1024px to make room for the search component.

@pedrosousa
pedrosousa requested review from a team and jrf0110 June 15, 2021 17:19
@jrf0110

jrf0110 commented Jun 16, 2021

Copy link
Copy Markdown
Contributor

@gganch can you pull this branch down and test locally?

@gganch

gganch commented Jun 17, 2021

Copy link
Copy Markdown
Contributor

@pedrosousa @jrf0110 I just tested it locally and everything seems to be working perfectly. Love that there is a global search now, pretty cool!

But on mobile it is a little hard to know that there is a search option

Screen Shot 2021-06-17 at 5 31 52 PM

can we put the 'search docs...' or something similar to let users know that you can search??

Pedro would you mind updating the description of this PR to give a little more context what you implemented?

@pedrosousa

Copy link
Copy Markdown
Contributor Author

But on mobile it is a little hard to know that there is a search option

Screen Shot 2021-06-17 at 5 31 52 PM

can we put the 'search docs...' or something similar to let users know that you can search??

Regarding the mobile version, I followed the current implementation for each product's documentation, which only displays the icon until you click it:

image
image

I'll see what I can do about this.

@KimJ15

KimJ15 commented Jun 28, 2021

Copy link
Copy Markdown
Contributor

@pedrosousa I think we can iterate and improve the mobile experience as a different PR given all search experiences would need to be updated.

@pedrosousa

Copy link
Copy Markdown
Contributor Author

Yes, I agree.
@gganch I'll create a separate ticket for addressing this improvement. It will affect all product documentation areas, since they all share the same UI issue you identified.

@pedrosousa

Copy link
Copy Markdown
Contributor Author

@jrf0110 Since GG is OOO, can you approve this PR?

@jrf0110 jrf0110 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry, @pedrosousa - I never submitted this review. I added some comments a while back and just let them sit in pending.

Comment thread developers.cloudflare.com/docs-config.js
Comment thread developers.cloudflare.com/src/components/site-search.js Outdated
Comment thread developers.cloudflare.com/src/components/site-search.js Outdated
@pedrosousa
pedrosousa requested a review from jrf0110 July 6, 2021 14:48
@gganch
gganch self-requested a review July 9, 2021 19:58
@gganch

gganch commented Jul 9, 2021

Copy link
Copy Markdown
Contributor

it looks pretty good to me! I am trying to approve but I cant it seems like...

Comment thread developers.cloudflare.com/src/components/site-search.js Outdated

@jrf0110 jrf0110 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tested in Chrome, Firefox, and Edge. LGTM

@pedrosousa
pedrosousa merged commit b84482f into production Jul 21, 2021
@pedrosousa
pedrosousa deleted the pedro/global-docs-search branch July 21, 2021 11:44
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.

4 participants