Skip to content

Migrate from Google search to MkDocs. #2849

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 8 commits into from
Jun 1, 2015
Merged

Conversation

d0ugal
Copy link
Contributor

@d0ugal d0ugal commented Apr 21, 2015

NOTE: This is dependant on MkDocs pull request 457.

Putting this up for review, but it is likely that it can't be merged for a while. All of these commits except the last are applicable to the latest MkDocs release (but there is a bug that needs a point release). I can break the cleanup commits at some point if it helps as they are not really related to search at all - sorry!

This is what the current work looks like at the moment.

Search screenshot

@tomchristie
Copy link
Member

Looks great!

@d0ugal
Copy link
Contributor Author

d0ugal commented Apr 23, 2015

I've done a few updates so that the theme only loads the search index when the form is submitted. This is a bit nicer, as before it was loading 1.1mb of JSON on any page on load. (As a side, Docker ran into this problem with their Tipue search implementation, which I think makes it somewhat harder to solve.)

Other than improvements in style, which I'm not great at, I can't think of anything else that needs to be done here. If anyone has time to test this out and give feedback I'd be grateful. Ideally it would be good to get feedback before I land the change in MkDocs. mkdocs/mkdocs#457


$('pre code').parent().addClass('prettyprint well');

$(document).on("submit", "#mkdocs_search_modal form", function (e) {
$("#mkdocs-search-results").html("Searching...")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need a ; here.

@jpadilla
Copy link
Member

@d0ugal I've been checking this out. Truly great and exciting work you've been pushing out with mkdocs!

@tomchristie
Copy link
Member

From my POV I'm happy with the screenshot & @jpadilla's review.
I'm ok for this to go in once it's in MkDocs.

@d0ugal
Copy link
Contributor Author

d0ugal commented Apr 27, 2015

Cool. Merged in MkDocs! I'll come back to this once we get closer to a release, I'm thinking it shouldn't be too long away.

@d0ugal
Copy link
Contributor Author

d0ugal commented May 27, 2015

MkDocs 0.13 has now been released. I think this probably just needs some testing to check it all still works okay. I'll try and do this soon but initially focusing on upgrading ReadTheDocs which is stuck on MkDocs 0.11 (and is thus providing me with many confused users).

@tomchristie
Copy link
Member

Looking super lovely. ✨

d0ugal added 7 commits May 31, 2015 18:30
This allows us to delete lots of code and avoid hard-coding the
navigation. This does mean that {{ current_page }} isn't always
available and needs to be conditionally used.
The {{ page_title }} and {{ site_name }} variables are now separated to
add flexibility th themes.
This change updates the modal to use MkDocs for search.
This is optional, but will be required by MkDocs 1.0
@d0ugal
Copy link
Contributor Author

d0ugal commented May 31, 2015

I've rebased and updated this PR. As far as I can tell, it should be ready. My only concern would be cross browser support, I have only tested the latest FireFox and Chrome.

@tomchristie
Copy link
Member

Looks great - may as well merge this in now.
I did notice that when first using a page the searching appeared to only initiate on <enter> in the text box. After pressing enter once the searching then worked automatically on text changes.
No idea if the issue is specific to mkdocs serve or if it'd also appear on live.

tomchristie added a commit that referenced this pull request Jun 1, 2015
Migrate from Google search to MkDocs.
@tomchristie tomchristie merged commit a0f66ff into encode:master Jun 1, 2015
@d0ugal
Copy link
Contributor Author

d0ugal commented Jun 1, 2015

To avoid loading the index on page load, I think it starts the download when you first search. So it might just be a delay as it downloads the JSON. I forget exactly how I set it up in the theme, I'll check.

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.

3 participants