forked from snxraven/ravenscott-blog
Add search feature
This commit is contained in:
@ -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">
|
||||
|
Reference in New Issue
Block a user