Add search feature

This commit is contained in:
Raven Scott
2024-09-26 01:27:35 -04:00
parent 5dc2d2e6bc
commit 8e02173583
2 changed files with 51 additions and 90 deletions

View File

@ -35,12 +35,21 @@
<div class="container text-center">
<h1>Hello, my name is Raven Scott</h1>
<p class="lead">Where Technology Meets Creativity: Insights from a Linux Enthusiast</p>
<form action="/" method="get" class="mb-4">
<div class="input-group">
<input type="text" name="search" class="form-control" placeholder="Search blog posts..." value="<%= typeof searchQuery !== 'undefined' ? searchQuery : '' %>">
<button type="submit" class="btn btn-primary">Search</button>
</div>
</form>
</div>
</header>
<!-- Search form -->
<section class="py-5">
<div class="container">
<h2>Recent Posts</h2>
<!-- Blog post list -->
<h2><%= searchQuery ? `Search results for "${searchQuery}"` : 'Recent Posts' %></h2>
<ul class="list-group list-group-flush">
<% blogPosts.forEach(post => { %>
<li class="list-group-item d-flex justify-content-between align-items-center py-4">
@ -58,9 +67,7 @@
</li>
<% }) %>
</ul>
</div>
</section>
<!-- Pagination controls -->
<nav aria-label="Page navigation">
<ul class="pagination justify-content-center mt-4">