Skip to content

Commit 12e62ce

Browse files
authored
Replaced website search with Google, similar to hyperscript.org. Removed non-working Algolia, docsearch. Issue: #1328 (#1342)
1 parent 4883aa8 commit 12e62ce

2 files changed

Lines changed: 36 additions & 51 deletions

File tree

www/_includes/layout.njk

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
Prism.highlightAllUnder(content);
1818
})
1919
</script>
20-
21-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css" />
22-
2320
</head>
2421
<body hx-ext="class-tools, preload">
2522

@@ -55,12 +52,11 @@
5552
<div>
5653
<a href="/essays/">essays</a>
5754
</div>
58-
<div>
59-
<input _="on keyup[key is 'Escape'] or click elsewhere
60-
blur() then set my.value to ''
61-
on keyup[key is '/'] from <body/>
62-
focus()"
63-
placeholder="&#128269;" type="text" id="search"/>
55+
<div hx-disable>
56+
<form action="https://google.com/search">
57+
<input type="hidden" name="q" value="site:htmx.org">
58+
<label><span style="display:none;">Search</span><input type="text" name="q" placeholder="🔍️" class="search-box"></label>
59+
</form>
6460
</div>
6561
</div>
6662
<div class="github-stars">
@@ -117,13 +113,5 @@
117113
</div>
118114
</footer>
119115

120-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script>
121-
<script type="text/javascript"> docsearch({
122-
apiKey: '47070108e6ce8dfee6beee94b83bee7d',
123-
indexName: 'htmx',
124-
inputSelector: '#search',
125-
debug: false // Set debug to true if you want to inspect the dropdown
126-
});
127-
</script>
128116
</body>
129117
</html>

www/css/site.css

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -407,58 +407,55 @@ h1,h2,h3,h4{
407407

408408

409409
.logo-wrapper {
410-
white-space: nowrap;
410+
white-space: nowrap;
411411
}
412412

413413
table td:first-child code {
414-
display: block;
415-
background: none;
414+
display: block;
415+
background: none;
416416
}
417417

418-
419-
#search {
420-
transition: all 0.3s ease-out;
421-
width: 3em;
422-
padding: 6px 8px;
423-
border: 1px solid #eee;
424-
background-color: inherit;
425-
border-radius: 10px;
426-
margin-right: 6px;
427-
position: relative;
428-
vertical-align: top;
418+
.search-box {
419+
transition: all .2s ease-in-out;
420+
width: 2.5rem;
421+
padding: 4px 6px;
422+
border: 2px solid #eee;
423+
border-radius: 10px;
424+
margin-right: 10px;
425+
outline: 0;
429426
}
430427

431-
432-
#search:hover, #search:not(:placeholder-shown) {
433-
border: 1px solid rgb(204, 204, 204);
434-
background-color: white;
428+
.search-box::placeholder {
429+
text-align: right;
435430
}
436431

432+
.search-box:hover, .search-box:not(:placeholder-shown) {
433+
border: 2px solid var(--midBlue);
434+
}
437435

438-
#search:focus, #search:not(:placeholder-shown) {
439-
width: 150px;
440-
border-radius: 4px;
436+
.search-box:active, .search-box:focus, .search-box:not(:placeholder-shown) {
437+
width: 10rem;
441438
}
442439

443440
footer {
444-
margin-top: 2em;
445-
padding-top: 2em;
446-
padding-bottom: 5em;
447-
background-color: #f6f6f6;
441+
margin-top: 2em;
442+
padding-top: 2em;
443+
padding-bottom: 5em;
444+
background-color: #f6f6f6;
448445
}
449446

450447
footer .footer-menu {
451-
text-align: right;
448+
text-align: right;
452449
}
453450

454451
@media(max-width:45rem) {
455-
footer .footer-haiku {
456-
margin-bottom: 3em;
457-
}
452+
footer .footer-haiku {
453+
margin-bottom: 3em;
454+
}
458455

459-
footer .footer-menu {
460-
padding-top: 3em;
461-
border-top: 1px solid #eee;
462-
text-align: left;
463-
}
456+
footer .footer-menu {
457+
padding-top: 3em;
458+
border-top: 1px solid #eee;
459+
text-align: left;
460+
}
464461
}

0 commit comments

Comments
 (0)