feat: add site search

This commit is contained in:
Cory Dransfeldt 2023-07-04 17:07:06 -07:00
parent dd98b01bbd
commit 74699d618c
No known key found for this signature in database
8 changed files with 129 additions and 32 deletions

View file

@ -57,6 +57,10 @@
{% jsonLd meta, type, tags %}
</script>
<script defer data-domain="coryd.dev" src="https://coryd.dev/js/script.js"></script>
<script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>
<noscript>
<style>.client-side {display:none}</style>
</noscript>
</head>
<body class="dark:text-white bg-white dark:bg-gray-900 font-sans text-gray-800">
{{ content }}

View file

@ -0,0 +1,7 @@
<a href="/search" title="Search posts">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
class="inline w-6 h-6 outline-current text-gray-700 hover:text-purple-500 dark:text-gray-200 dark:hover:text-purple-500{% if page.url == '/search/' %} active{% endif %}">
<path stroke-linecap="round" stroke-linejoin="round"
d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"/>
</svg>
</a>

View file

@ -9,6 +9,9 @@
<li class="mr-6">
{% include "icons/tags.liquid" %}
</li>
<li class="mr-6 client-side">
{% include "icons/search.liquid" %}
</li>
<li>
{% include "icons/rss.liquid" %}
</li>

View file

@ -2,8 +2,8 @@
layout: main
---
{% include "header.liquid" %}
<article class="h-entry">
<h2 class="p-name text-xl md:text-2xl font-black leading-tight dark:text-gray-200 pt-8">{{ title }}</h2>
<article class="h-entry" data-pagefind-body>
<h2 class="p-name text-xl md:text-2xl font-black leading-tight dark:text-gray-200 pt-8" data-pagefind-meta="title">{{ title }}</h2>
<span class="p-author h-card hidden">{{ site.title }}</span>
<time class="mt-2 mb-6 block text-sm dt-published" datetime="{{ date }}">{{ date | readableDate }}</time>
<div class="p-summary hidden">{{ post_excerpt | markdown }}</div>