|
| 1 | +--- |
| 2 | +import Layout from '../../layouts/Layout.astro'; |
| 3 | +import { getCollection } from 'astro:content'; |
| 4 | +import { slugify } from '../../utils/slugs'; |
| 5 | +
|
| 6 | +const posts = await getCollection('blog'); |
| 7 | +const sortedPosts = posts.sort((a, b) => { |
| 8 | + const dateA = a.data.date ? new Date(a.data.date).valueOf() : 0; |
| 9 | + const dateB = b.data.date ? new Date(b.data.date).valueOf() : 0; |
| 10 | + return dateB - dateA; |
| 11 | +}); |
| 12 | +--- |
| 13 | + |
| 14 | +<Layout title="Blog" description="Updates and news from the Open Science for Librarians project."> |
| 15 | + <header class="masthead" style="background-image: url('/assets/img/background-image-blue.png'); background-size: cover; height: 40vh; min-height: 300px;"> |
| 16 | + <div class="container h-100"> |
| 17 | + <div class="row h-100 align-items-center justify-content-center text-center"> |
| 18 | + <div class="col-lg-10 align-self-end"> |
| 19 | + <h1 class="text-white font-weight-bold" style="text-shadow: 2px 2px 4px rgba(0,0,0,0.6);">Project Updates</h1> |
| 20 | + <hr class="divider my-4" style="border-color: #ffd100; border-width: 3px; max-width: 50px;" /> |
| 21 | + </div> |
| 22 | + <div class="col-lg-8 align-self-baseline"> |
| 23 | + <p class="text-white-75 font-weight-light" style="text-shadow: 1px 1px 2px rgba(0,0,0,0.5);"> |
| 24 | + News, announcements, and progress reports. |
| 25 | + </p> |
| 26 | + </div> |
| 27 | + </div> |
| 28 | + </div> |
| 29 | + </header> |
| 30 | + |
| 31 | + <section class="page-section bg-light" id="blog"> |
| 32 | + <div class="container"> |
| 33 | + <div class="row"> |
| 34 | + {sortedPosts.map(post => ( |
| 35 | + <div class="col-lg-4 col-md-6 mb-4"> |
| 36 | + <div class="card h-100 border-0 shadow-sm blog-card"> |
| 37 | + <div class="card-body"> |
| 38 | + <small class="text-muted text-uppercase mb-2 d-block"> |
| 39 | + {post.data.date ? new Date(post.data.date).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' }) : ''} |
| 40 | + </small> |
| 41 | + <h4 class="card-title mb-3"> |
| 42 | + <a href={`/blog/${post.slug}`} class="text-dark text-decoration-none stretched-link"> |
| 43 | + {post.data.title} |
| 44 | + </a> |
| 45 | + </h4> |
| 46 | + <p class="card-text text-muted"> |
| 47 | + {post.data.description || "Read more about this update..."} |
| 48 | + </p> |
| 49 | + </div> |
| 50 | + <div class="card-footer bg-transparent border-top-0 pt-0 pb-4"> |
| 51 | + <div class="d-flex align-items-center"> |
| 52 | + <div class="small"> |
| 53 | + By <span class="font-weight-bold text-primary">{post.data.author}</span> |
| 54 | + </div> |
| 55 | + </div> |
| 56 | + </div> |
| 57 | + </div> |
| 58 | + </div> |
| 59 | + ))} |
| 60 | + </div> |
| 61 | + </div> |
| 62 | + </section> |
| 63 | +</Layout> |
| 64 | + |
| 65 | +<style> |
| 66 | +.blog-card { |
| 67 | + transition: transform 0.2s; |
| 68 | +} |
| 69 | +.blog-card:hover { |
| 70 | + transform: translateY(-5px); |
| 71 | +} |
| 72 | +</style> |
0 commit comments