feat: add search functionality

Refs: #25
This commit is contained in:
Oliver Davies 2022-10-19 21:52:04 +01:00
parent 7ee59c28df
commit 362f2335ec
2 changed files with 11 additions and 13 deletions

View file

@ -31,6 +31,10 @@ const footerLinks = [
title: 'Daily list', title: 'Daily list',
href: '/daily', href: '/daily',
}, },
{
title: 'Search',
href: '/search',
},
] ]
--- ---

View file

@ -1,17 +1,11 @@
--- ---
import PageLayout from '../layouts/PageLayout.astro'
--- ---
<script> <PageLayout title="Search">
import Alpine from 'alpinejs'; <form action="https://www.google.com/search" method="get">
<input type="hidden" name="q" value="site:https://www.oliverdavies.uk">
window.Alpine = Alpine; <input type="text" name="q" alt="search">
Alpine.start(); <input type="submit" value="Search">
</script>
<div x-data="{ term: '' }">
<form :action="`https://www.google.com/search?q=site%3Aoliverdavies.uk+%22` + term + `%22`">
<input type="text" x-model="term" />
<button>Search</button>
</form> </form>
</div> </PageLayout>