Skip to content

Commit

Permalink
copyright, cover images
Browse files Browse the repository at this point in the history
  • Loading branch information
Mordechai Dror committed Sep 24, 2023
1 parent c93f591 commit c05958f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
6 changes: 5 additions & 1 deletion src/components/Footer.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import '@fortawesome/fontawesome-free/css/fontawesome.css';
import '@fortawesome/fontawesome-free/css/solid.css';
---

<footer class="flex flex-row-reverse gap-1 items-center p-4 border-t">
<footer class="flex gap-1 items-center p-4 border-t">
<span class="text-gray-500">Mordechai Dror © 2023-present</span>

<div class="flex-1"></div>

<a href="/rss.xml"
target="_blank">
<i class='fa-solid fa-rss fa-lg'></i>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 4 additions & 6 deletions src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ import { z, defineCollection } from 'astro:content';

const posts = defineCollection({
type: 'content',
schema: z.object({
schema: ({image}) => z.object({
title: z.string(),
description: z.string(),
tags: z.array(z.string()),
platforms: z.array(z.string()),
publishedAt: z.date(),
coverImage: image().optional(),
}),
});

const attachments = defineCollection({
type: 'content',
});

export const collections = { posts, attachments };
export const collections = { posts };
1 change: 1 addition & 0 deletions src/content/posts/aws-amplify-functions-on-steroids.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ tags:
platforms:
- https://vorant94.medium.com/aws-amplify-functions-on-steroids-bffbfc09960c
publishedAt: 2023-07-05
coverImage: ../attachments/amplify-functions-on-steroids-cover.png
---
### What we have out of the box

Expand Down
13 changes: 11 additions & 2 deletions src/pages/posts/[...slug].astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
import { getCollection, type CollectionEntry } from 'astro:content';
import Layout from '../../layouts/Layout.astro';
import { getImage, Image } from "astro:assets";
interface Props {
post: CollectionEntry<'posts'>;
Expand All @@ -16,12 +17,20 @@ export async function getStaticPaths() {
}
const { post } = Astro.props;
const { Content } = await post.render();
const {title, coverImage} = post.data;
const coverImageSrc = coverImage && (await getImage({src: coverImage, format: coverImage.format})).src;
const { Content } = await post.render();
---

<Layout title={post.data.title}>
<Layout title={title}
image={coverImageSrc}>
<article class="prose">
<h1>{title}</h1>

{ coverImage && <Image src={coverImage} alt="" /> }

<Content />
</article>

Expand Down

0 comments on commit c05958f

Please sign in to comment.