2024-09-16 07:53:26 -04:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
2024-09-26 04:55:38 -04:00
|
|
|
<meta name="description" content="<%= process.env.OWNER_NAME %>'s Blog">
|
2024-09-16 07:53:26 -04:00
|
|
|
<title><%= title %></title>
|
|
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css">
|
2024-09-26 01:51:44 -04:00
|
|
|
<link rel="stylesheet" href="<%= process.env.HOST_URL %>/css/styles.css">
|
2024-09-26 19:56:40 -04:00
|
|
|
<script>
|
|
|
|
window.onload = function() {
|
|
|
|
const input = document.getElementById("search-input");
|
|
|
|
input.focus();
|
|
|
|
input.setSelectionRange(input.value.length, input.value.length);
|
|
|
|
};
|
|
|
|
</script>
|
2024-09-16 07:53:26 -04:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<!-- Navbar -->
|
|
|
|
<nav class="navbar navbar-expand-lg navbar-dark">
|
|
|
|
<div class="container-fluid">
|
2024-09-26 02:41:22 -04:00
|
|
|
<a class="navbar-brand" href="<%= process.env.HOST_URL %>"><%= process.env.SITE_NAME %></a>
|
2024-09-16 07:53:26 -04:00
|
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
|
|
|
<span class="navbar-toggler-icon"></span>
|
|
|
|
</button>
|
|
|
|
<div class="collapse navbar-collapse" id="navbarNav">
|
|
|
|
<ul class="navbar-nav ms-auto">
|
2024-09-26 18:13:47 -04:00
|
|
|
<% menuItems.forEach(item => { %>
|
|
|
|
<li class="nav-item">
|
2024-09-26 18:19:30 -04:00
|
|
|
<a class="nav-link" href="<%= item.url %>" <%= item.openNewPage ? 'target="_blank"' : '' %>><%= item.title %></a>
|
2024-09-26 18:13:47 -04:00
|
|
|
</li>
|
|
|
|
<% }) %>
|
2024-09-16 07:53:26 -04:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</nav>
|
2024-09-26 18:47:09 -04:00
|
|
|
|
2024-09-26 18:13:47 -04:00
|
|
|
|
|
|
|
<!-- Main Content -->
|
2024-09-16 07:53:26 -04:00
|
|
|
<header class="py-5">
|
|
|
|
<div class="container text-center">
|
2024-09-26 02:44:16 -04:00
|
|
|
<h1><%= process.env.FRONT_PAGE_TITLE %></h1>
|
|
|
|
<p class="lead"><%= process.env.FRONT_PAGE_LEAD %></p>
|
2024-09-26 17:46:21 -04:00
|
|
|
<form action="/" method="get" class="mb-4">
|
2024-09-26 01:27:35 -04:00
|
|
|
<div class="input-group">
|
2024-09-26 19:53:01 -04:00
|
|
|
<input type="text" id="search-input" name="search" class="form-control" placeholder="Search blog posts..." value="<%= typeof searchQuery !== 'undefined' ? searchQuery : '' %>" autofocus>
|
2024-09-26 01:27:35 -04:00
|
|
|
</div>
|
|
|
|
</form>
|
2024-09-16 07:53:26 -04:00
|
|
|
</div>
|
|
|
|
</header>
|
2024-09-26 01:27:35 -04:00
|
|
|
|
2024-09-26 18:13:47 -04:00
|
|
|
<!-- Blog Content -->
|
2024-09-16 07:53:26 -04:00
|
|
|
<section class="py-5">
|
|
|
|
<div class="container">
|
2024-09-26 01:27:35 -04:00
|
|
|
<!-- Blog post list -->
|
2024-09-26 02:00:48 -04:00
|
|
|
<% if (noResults) { %>
|
2024-09-26 18:13:47 -04:00
|
|
|
<p><center>Sorry, no blog posts found matching "<%= searchQuery %>"</center></p>
|
2024-09-26 02:00:48 -04:00
|
|
|
<% } else { %>
|
2024-09-26 18:13:47 -04:00
|
|
|
<h2><%= searchQuery ? 'Search results for "' + searchQuery + '"' : 'Recent Posts' %></h2>
|
2024-09-26 02:00:48 -04:00
|
|
|
<% } %>
|
2024-09-16 13:42:27 -04:00
|
|
|
<ul class="list-group list-group-flush">
|
2024-09-25 23:05:49 -04:00
|
|
|
<% blogPosts.forEach(post => { %>
|
2024-09-16 13:42:27 -04:00
|
|
|
<li class="list-group-item d-flex justify-content-between align-items-center py-4">
|
|
|
|
<div>
|
2024-09-26 18:13:47 -04:00
|
|
|
<h5 class="mb-1"><a href="<%= process.env.BLOG_URL %><%= post.slug %>"><%= post.title %></a></h5>
|
2024-09-25 23:05:49 -04:00
|
|
|
<p class="mb-1 text-muted">Posted on
|
|
|
|
<%= new Date(post.dateCreated).toLocaleDateString('en-US', {
|
|
|
|
year: 'numeric',
|
|
|
|
month: 'long',
|
|
|
|
day: 'numeric'
|
|
|
|
}) %>
|
|
|
|
</p>
|
2024-09-16 07:53:26 -04:00
|
|
|
</div>
|
2024-09-26 03:03:40 -04:00
|
|
|
<a href="<%= process.env.BLOG_URL %><%= post.slug %>" class="btn btn-outline-primary">Read Article</a>
|
2024-09-16 13:42:27 -04:00
|
|
|
</li>
|
2024-09-16 07:53:26 -04:00
|
|
|
<% }) %>
|
2024-09-16 13:42:27 -04:00
|
|
|
</ul>
|
2024-09-26 01:27:35 -04:00
|
|
|
|
2024-09-16 13:42:27 -04:00
|
|
|
<!-- Pagination controls -->
|
|
|
|
<nav aria-label="Page navigation">
|
|
|
|
<ul class="pagination justify-content-center mt-4">
|
|
|
|
<% if (currentPage > 1) { %>
|
|
|
|
<li class="page-item">
|
|
|
|
<a class="page-link" href="?page=<%= currentPage - 1 %>">Previous</a>
|
|
|
|
</li>
|
|
|
|
<% } %>
|
2024-09-26 18:13:47 -04:00
|
|
|
|
2024-09-16 13:42:27 -04:00
|
|
|
<% for (let i = 1; i <= totalPages; i++) { %>
|
|
|
|
<li class="page-item <%= currentPage === i ? 'active' : '' %>">
|
|
|
|
<a class="page-link" href="?page=<%= i %>"><%= i %></a>
|
|
|
|
</li>
|
|
|
|
<% } %>
|
2024-09-26 18:13:47 -04:00
|
|
|
|
2024-09-16 13:42:27 -04:00
|
|
|
<% if (currentPage < totalPages) { %>
|
|
|
|
<li class="page-item">
|
|
|
|
<a class="page-link" href="?page=<%= currentPage + 1 %>">Next</a>
|
|
|
|
</li>
|
|
|
|
<% } %>
|
|
|
|
</ul>
|
|
|
|
</nav>
|
2024-09-16 07:53:26 -04:00
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
|
2024-09-26 02:25:35 -04:00
|
|
|
<footer class="text-white text-center py-4">
|
2024-09-16 07:53:26 -04:00
|
|
|
<div class="container">
|
2024-09-26 20:47:45 -04:00
|
|
|
<h4 class="footer-logo mb-3"><%= process.env.FOOTER_TAGLINE %></h4>
|
|
|
|
<p class="footer-links mb-3">
|
|
|
|
<a href="/" class="text-white text-decoration-none me-3">Home</a>
|
|
|
|
<a href="/about" class="text-white text-decoration-none me-3">About</a>
|
|
|
|
<a href="/contact" class="text-white text-decoration-none me-3">Contact</a>
|
|
|
|
<a href="<%= process.env.HOST_URL %>/sitemap.xml" class="text-white text-decoration-none me-3">Sitemap</a>
|
|
|
|
<a href="<%= process.env.HOST_URL %>/rss" class="text-white text-decoration-none">RSS Feed</a>
|
|
|
|
</p>
|
2024-09-26 02:41:22 -04:00
|
|
|
<p class="mb-0">© 2024 <%= process.env.OWNER_NAME %>. All rights reserved.</p>
|
2024-09-16 07:53:26 -04:00
|
|
|
</div>
|
|
|
|
</footer>
|
|
|
|
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
|
2024-09-26 19:15:04 -04:00
|
|
|
<script>
|
|
|
|
let typingTimer; // Timer identifier
|
|
|
|
const doneTypingInterval = 500; // Time in ms, adjust for desired delay
|
|
|
|
|
|
|
|
const searchInput = document.getElementById('search-input');
|
|
|
|
|
|
|
|
searchInput.addEventListener('input', function() {
|
|
|
|
clearTimeout(typingTimer);
|
|
|
|
typingTimer = setTimeout(function() {
|
|
|
|
searchInput.form.submit();
|
|
|
|
}, doneTypingInterval);
|
|
|
|
});
|
|
|
|
|
|
|
|
searchInput.addEventListener('keydown', function() {
|
|
|
|
clearTimeout(typingTimer);
|
|
|
|
});
|
|
|
|
</script>
|
2024-09-16 07:53:26 -04:00
|
|
|
</body>
|
|
|
|
</html>
|