I kinda liked the built-in Google search that being on Blogger offered, at least it was better than the search included in Wordpress. Unfortunately after moving off Blogger, the only thing I could find is Google's Custom Search Engine (CSE) which is ugly as fuck (and doesn't work without Javascript).

I'd tried multiple times to implement one myself, including variations of this stack overflow answer which looks like this:

  <form id="searchForm" name="searchForm" action="http://google.com/search">
    <input name="q" type="text" value="search" maxlength="200" />
    <input name="q" type="hidden" value="site:mysite.com"/>
    <input name="submit" type="submit" value="Search" />
  </form>

Unfortunately, it doesn't seem to work! I don't know if it ever did, or if Chromium is suddenly adhering to a standard that disallows multiple form elements with the same name, but only the first element is passed to the server. After fooling around a bit, came upon a different SO answer with a slightly different syntax:

<form action="http://google.com/search" method="get">
<input type="hidden" name="sitesearch" value="http://acme.com" />
<input type="text" name="q" />
</form>

... and it actually works. For now, at least - who knows if big-G will decide to stop this service from working to encourage people to inject more advertising into their sites (they can stick ads in my search results, I don't mind, but I'm doing my best to keep the site as creepy-free as possible).

Styling it took a bit of extra effort - it took me far longer than it should have to realize I didn't include the buttons in my Bootstrap configuration.

Speaking of styling, I fixed a few other things as well - I finally got the dropdown navigation on the mobile version to work (again, a missing Bootstrap component!) so I did away with the sidebar (part of my site that's long bothered me) and moved almost everything into a dropdown. I'm still not happy with that, so I took the stuff that was in the dropdown and put it at the bottom of my site, leaving the search box and the two most important navigation items at the top.

I'm just using a naive group of links for the "about me" shit at the bottom, which I'm not happy with (for one thing it looks like shit on a mobile browser) but I'll do something about that another day. I still want to clean the footer up completely, and make it more mobile-friendly, as well as I'd really like to do some nice navigation buttons for navigating between entries (ideally working out how to do swiping left/right on mobile would be neat).

Horsham, VIC, Australia fwaggle

Published:


Modified:

Never

Filed under:


Location:

Horsham, VIC, Australia

Navigation: Older Entry Newer Entry