chore: run prettier on Astro files

This commit is contained in:
Oliver Davies 2023-01-08 19:25:23 +00:00
parent a489a2ca02
commit 40d8e58cce
17 changed files with 1005 additions and 330 deletions

View file

@ -3,13 +3,21 @@
<div class="flex mt-4 space-x-4">
<div class="flex-shrink-0">
<img src="/images/social-avatar.jpg" alt="Picture of Oliver" class="w-16 h-16 rounded-full border border-grey">
<img
src="/images/social-avatar.jpg"
alt="Picture of Oliver"
class="w-16 h-16 rounded-full border border-grey"
/>
</div>
<div>
<p>
Oliver Davies is a PHP Developer and Linux Systems Administrator based in the UK.
He is a Full Stack Software Consultant specialising in Drupal application development, and a Lead Developer at <a href="https://tfw.wales" class="link">Transport for Wales</a>.
Oliver Davies is a PHP Developer and Linux Systems Administrator based
in the UK. He is a Full Stack Software Consultant specialising in Drupal
application development, and a Lead Developer at <a
href="https://tfw.wales"
class="link">Transport for Wales</a
>.
</p>
</div>
</div>

View file

@ -1,62 +1,63 @@
---
export interface Props {
title: string;
body: string;
href: string;
title: string;
body: string;
href: string;
}
const { href, title, body } = Astro.props;
---
<li class="link-card">
<a href={href}>
<h2>
{title}
<span>&rarr;</span>
</h2>
<p>
{body}
</p>
</a>
<a href={href}>
<h2>
{title}
<span>&rarr;</span>
</h2>
<p>
{body}
</p>
</a>
</li>
<style>
.link-card {
list-style: none;
display: flex;
padding: 0.15rem;
background-color: white;
background-image: var(--accent-gradient);
background-size: 400%;
border-radius: 0.5rem;
background-position: 100%;
transition: background-position 0.6s cubic-bezier(0.22, 1, 0.36, 1);
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}
.link-card {
list-style: none;
display: flex;
padding: 0.15rem;
background-color: white;
background-image: var(--accent-gradient);
background-size: 400%;
border-radius: 0.5rem;
background-position: 100%;
transition: background-position 0.6s cubic-bezier(0.22, 1, 0.36, 1);
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
0 2px 4px -2px rgba(0, 0, 0, 0.1);
}
.link-card > a {
width: 100%;
text-decoration: none;
line-height: 1.4;
padding: 1rem 1.3rem;
border-radius: 0.35rem;
color: #111;
background-color: white;
opacity: 0.8;
}
h2 {
margin: 0;
font-size: 1.25rem;
transition: color 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
p {
margin-top: 0.5rem;
margin-bottom: 0;
color: #444;
}
.link-card:is(:hover, :focus-within) {
background-position: 0;
}
.link-card:is(:hover, :focus-within) h2 {
color: rgb(var(--accent));
}
.link-card > a {
width: 100%;
text-decoration: none;
line-height: 1.4;
padding: 1rem 1.3rem;
border-radius: 0.35rem;
color: #111;
background-color: white;
opacity: 0.8;
}
h2 {
margin: 0;
font-size: 1.25rem;
transition: color 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
p {
margin-top: 0.5rem;
margin-bottom: 0;
color: #444;
}
.link-card:is(:hover, :focus-within) {
background-position: 0;
}
.link-card:is(:hover, :focus-within) h2 {
color: rgb(var(--accent));
}
</style>

File diff suppressed because one or more lines are too long

View file

@ -9,14 +9,15 @@
viewBox="0 0 706 504"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M456.5 1.1c-12.3 1.5-31 5.5-44.1 9.4-12.7 3.9-63.6 24.6-64.1 26.2-.2.5 1.4 1.7 3.4 2.7 2.1 1 8.9 5.1 15.1 9.2l11.2 7.5 14.5-6c22.9-9.5 37.3-14 57.5-17.8 7.2-1.3 14.7-1.7 31-1.8 18.6 0 23.1.3 33 2.3 22 4.5 46.1 13.9 64.5 25.2 39.3 24.2 69.9 65.3 86.9 116.5 16.3 49.2 13 100.2-9.4 145.3-21.8 43.7-49.2 68.8-101.5 92.9-13.4 6.2-120.1 51.3-121.3 51.3-.5 0-15.7-35.1-33.7-78l-32.8-78 3.1-12.8c4.4-18 5.6-29.5 4.9-48.5-.6-16.8-2-25.7-6.3-38.7-12-35.8-40.8-69.2-74-85.6l-7.2-3.6-4.2-10c-2.4-5.6-3.9-10.3-3.4-10.7.5-.5 9.7-4.5 20.4-9s19.9-8.6 20.4-9.1c1.5-1.5-18.6-10.1-32.3-13.9l-6.8-1.9-20.6 8.7c-11.4 4.8-20.9 8.9-21.2 9.2-.2.3 2 6.3 5 13.3 3 7 5.5 12.8 5.5 12.9 0 .1-7.5.2-16.7.2-11.8.1-19.4.6-25.6 1.8-27.3 5.5-50.5 17.6-70.4 37-21.8 21.2-36.7 49-43 80.2-2.4 12.3-2.4 44 0 57.2 3.6 19.4 11.9 40.4 22.3 56 6.9 10.4 21.1 25.4 31.2 33 29.9 22.5 70.8 33.2 106.2 27.8 18.9-2.8 39.3-10.6 54.1-20.5 13.5-9.1 29.1-23.8 37.6-35.5 1.2-1.7 2.4-2.8 2.7-2.5.3.3 15.6 36.6 34.1 80.5 18.5 44 33.8 80.1 33.9 80.3.8.8 144.9-60.8 162.1-69.3 45.5-22.4 73.4-47.1 95.7-84.7 28-47.4 37.5-99.7 27.8-153.5-6.8-37.6-25-79-48.6-110.3-33.2-44.1-83-74.2-138.4-83.6-11.4-1.9-46.9-2.7-58.5-1.3zM259.2 141.4c42.4 10.9 77.8 50 84.8 93.8 1.6 9.9.8 34.5-1.4 44.8-5.2 24-15.5 43-32.6 60-20.7 20.6-42.8 31.3-67.7 32.7-26.9 1.5-53.2-6.2-74.3-21.7-29.4-21.7-46-56.2-46-95.7 0-45.4 27.2-89.6 66.1-107.2 8.2-3.7 21.7-7.9 29.4-9.1 10.4-1.6 30.8-.4 41.7 2.4z"/><path d="M201 20.6c-83 11.2-157 71-186.5 150.8-22.3 60.3-18.3 134.9 10.2 192 21.5 43.1 59.6 81.6 102.1 103.4 21.1 10.9 46.3 19 71.2 22.9 16.2 2.5 53.1 2.5 68.5 0 25.9-4.2 45.2-10.5 69-22.2 14.4-7.1 39.7-23.2 41.8-26.7.8-1.2-.2-4.6-4.3-14.5-2.9-7-5.7-13.2-6.1-13.7-.5-.5-4.3 1.7-8.6 5.1C320 447.1 277.6 462 232 462c-59.8 0-115.2-26.3-154.8-73.5-32.2-38.3-48.8-88.7-46.9-142 2-53.7 22.1-99.6 60.7-138.5 28.1-28.3 63-47.2 102.9-55.7 11.9-2.6 14.1-2.8 38.6-2.8 28.3 0 39.4 1.3 59 7 27.9 8.1 58.5 26.1 80.9 47.6l10.9 10.5-14.3 6c-7.8 3.2-14.5 6.4-14.7 7-.2.7 16.5 41.3 37.1 90.4 20.7 49.1 37.6 90.1 37.6 91.1 0 3.4-7.1 24.2-11.6 33.8-2.4 5.1-6.6 13.1-9.4 17.7l-5 8.3 6.6 15.6c5.5 12.9 6.9 15.4 8 14.4 2.8-2.3 19.2-27.8 24.4-37.9l5.3-10.3 8.3 19.8c4.7 10.9 8.7 20.1 8.9 20.3.6.6 60.8-24.6 74.5-31.2 29.7-14.2 52.7-35.8 65.3-61.1 16.9-34 17.6-70.8 2.2-112-17-45.3-45.8-76.7-82.5-90-18.2-6.5-43.1-9.1-63.5-6.5-11.5 1.4-30 5.8-40.3 9.5l-7.3 2.6L402.3 91c-20.3-21.3-37.9-34.3-65.4-48.3-33.4-17.1-63.7-23.8-105.9-23.6-10.7.1-24.2.7-30 1.5zM504.5 122c9.2 2.5 22.1 8.3 29.2 13.1 6.9 4.7 18.7 16.3 24.3 23.9 15.1 20.6 26.3 49 29 74 2.3 20.7-3.1 43-14.5 60.5-8.7 13.3-27.6 29.5-44.5 38-6 3.1-47.3 20.6-47.5 20.2-1.1-1.6-87.5-208-87.3-208.3.2-.2 7.4-3.3 15.8-6.9 22.5-9.5 33.8-13 55-16.9 1.4-.2 9.3-.3 17.5-.1 11.5.2 16.9.8 23 2.5z"/>
<path
d="M456.5 1.1c-12.3 1.5-31 5.5-44.1 9.4-12.7 3.9-63.6 24.6-64.1 26.2-.2.5 1.4 1.7 3.4 2.7 2.1 1 8.9 5.1 15.1 9.2l11.2 7.5 14.5-6c22.9-9.5 37.3-14 57.5-17.8 7.2-1.3 14.7-1.7 31-1.8 18.6 0 23.1.3 33 2.3 22 4.5 46.1 13.9 64.5 25.2 39.3 24.2 69.9 65.3 86.9 116.5 16.3 49.2 13 100.2-9.4 145.3-21.8 43.7-49.2 68.8-101.5 92.9-13.4 6.2-120.1 51.3-121.3 51.3-.5 0-15.7-35.1-33.7-78l-32.8-78 3.1-12.8c4.4-18 5.6-29.5 4.9-48.5-.6-16.8-2-25.7-6.3-38.7-12-35.8-40.8-69.2-74-85.6l-7.2-3.6-4.2-10c-2.4-5.6-3.9-10.3-3.4-10.7.5-.5 9.7-4.5 20.4-9s19.9-8.6 20.4-9.1c1.5-1.5-18.6-10.1-32.3-13.9l-6.8-1.9-20.6 8.7c-11.4 4.8-20.9 8.9-21.2 9.2-.2.3 2 6.3 5 13.3 3 7 5.5 12.8 5.5 12.9 0 .1-7.5.2-16.7.2-11.8.1-19.4.6-25.6 1.8-27.3 5.5-50.5 17.6-70.4 37-21.8 21.2-36.7 49-43 80.2-2.4 12.3-2.4 44 0 57.2 3.6 19.4 11.9 40.4 22.3 56 6.9 10.4 21.1 25.4 31.2 33 29.9 22.5 70.8 33.2 106.2 27.8 18.9-2.8 39.3-10.6 54.1-20.5 13.5-9.1 29.1-23.8 37.6-35.5 1.2-1.7 2.4-2.8 2.7-2.5.3.3 15.6 36.6 34.1 80.5 18.5 44 33.8 80.1 33.9 80.3.8.8 144.9-60.8 162.1-69.3 45.5-22.4 73.4-47.1 95.7-84.7 28-47.4 37.5-99.7 27.8-153.5-6.8-37.6-25-79-48.6-110.3-33.2-44.1-83-74.2-138.4-83.6-11.4-1.9-46.9-2.7-58.5-1.3zM259.2 141.4c42.4 10.9 77.8 50 84.8 93.8 1.6 9.9.8 34.5-1.4 44.8-5.2 24-15.5 43-32.6 60-20.7 20.6-42.8 31.3-67.7 32.7-26.9 1.5-53.2-6.2-74.3-21.7-29.4-21.7-46-56.2-46-95.7 0-45.4 27.2-89.6 66.1-107.2 8.2-3.7 21.7-7.9 29.4-9.1 10.4-1.6 30.8-.4 41.7 2.4z"
></path><path
d="M201 20.6c-83 11.2-157 71-186.5 150.8-22.3 60.3-18.3 134.9 10.2 192 21.5 43.1 59.6 81.6 102.1 103.4 21.1 10.9 46.3 19 71.2 22.9 16.2 2.5 53.1 2.5 68.5 0 25.9-4.2 45.2-10.5 69-22.2 14.4-7.1 39.7-23.2 41.8-26.7.8-1.2-.2-4.6-4.3-14.5-2.9-7-5.7-13.2-6.1-13.7-.5-.5-4.3 1.7-8.6 5.1C320 447.1 277.6 462 232 462c-59.8 0-115.2-26.3-154.8-73.5-32.2-38.3-48.8-88.7-46.9-142 2-53.7 22.1-99.6 60.7-138.5 28.1-28.3 63-47.2 102.9-55.7 11.9-2.6 14.1-2.8 38.6-2.8 28.3 0 39.4 1.3 59 7 27.9 8.1 58.5 26.1 80.9 47.6l10.9 10.5-14.3 6c-7.8 3.2-14.5 6.4-14.7 7-.2.7 16.5 41.3 37.1 90.4 20.7 49.1 37.6 90.1 37.6 91.1 0 3.4-7.1 24.2-11.6 33.8-2.4 5.1-6.6 13.1-9.4 17.7l-5 8.3 6.6 15.6c5.5 12.9 6.9 15.4 8 14.4 2.8-2.3 19.2-27.8 24.4-37.9l5.3-10.3 8.3 19.8c4.7 10.9 8.7 20.1 8.9 20.3.6.6 60.8-24.6 74.5-31.2 29.7-14.2 52.7-35.8 65.3-61.1 16.9-34 17.6-70.8 2.2-112-17-45.3-45.8-76.7-82.5-90-18.2-6.5-43.1-9.1-63.5-6.5-11.5 1.4-30 5.8-40.3 9.5l-7.3 2.6L402.3 91c-20.3-21.3-37.9-34.3-65.4-48.3-33.4-17.1-63.7-23.8-105.9-23.6-10.7.1-24.2.7-30 1.5zM504.5 122c9.2 2.5 22.1 8.3 29.2 13.1 6.9 4.7 18.7 16.3 24.3 23.9 15.1 20.6 26.3 49 29 74 2.3 20.7-3.1 43-14.5 60.5-8.7 13.3-27.6 29.5-44.5 38-6 3.1-47.3 20.6-47.5 20.2-1.1-1.6-87.5-208-87.3-208.3.2-.2 7.4-3.3 15.8-6.9 22.5-9.5 33.8-13 55-16.9 1.4-.2 9.3-.3 17.5-.1 11.5.2 16.9.8 23 2.5z"
></path>
</svg>
<span class="sr-only">
Oliver Davies
</span>
<span class="sr-only"> Oliver Davies</span>
</a>
</div>
</div>
</div>
</div>

View file

@ -1,42 +1,47 @@
---
interface Event {
date: string
location: string
name: string
online?: boolean
time: string
url?: string
date: string;
location: string;
name: string;
online?: boolean;
time: string;
url?: string;
}
interface Props {
events: Event[]
events: Event[];
}
const { events } = Astro.props
const { events } = Astro.props;
---
{events && (
<div>
<h2>Events</h2>
{
events && (
<div>
<ul class="ml-4 list-disc">
{events.map((event) => (
<li>
{event.url ? (<a class="link" href={event.url}>{event.name}</a>) : event.name}
<h2>Events</h2>
{event.location && `in ${event.location}`}
- {new Date(event.date).toLocaleDateString('en-GB', {
day: 'numeric',
month: 'long',
year: 'numeric',
})}
{event.online && '(online)'}
</li>
))}
</ul>
<div>
<ul class="ml-4 list-disc">
{events.map((event) => (
<li>
{event.url ? (
<a class="link" href={event.url}>
{event.name}
</a>
) : (
event.name
)}
{event.location && `in ${event.location}`}-{" "}
{new Date(event.date).toLocaleDateString("en-GB", {
day: "numeric",
month: "long",
year: "numeric",
})}
{event.online && "(online)"}
</li>
))}
</ul>
</div>
</div>
</div>
)}
)
}

View file

@ -1,10 +1,10 @@
---
interface Props {
id: string
ratio?: string
id: string;
ratio?: string;
}
const { id, ratio }: Props = Astro.props
const { id, ratio }: Props = Astro.props;
---
<div>
@ -15,7 +15,7 @@ const { id, ratio }: Props = Astro.props
<script
class="speakerdeck-embed"
data-id={id}
data-ratio={ratio ?? '1.29456384323641'}
data-ratio={ratio ?? "1.29456384323641"}
src="//speakerdeck.com/assets/embed.js"
></script>
</div>

View file

@ -1,25 +1,26 @@
---
interface Props {
id: string
type: string
id: string;
type: string;
}
const { id, type }: Props = Astro.props
const { id, type }: Props = Astro.props;
---
{type == "youtube" && (
<div>
<h2 class="mb-2">Video</h2>
{
type == "youtube" && (
<div>
<h2 class="mb-2">Video</h2>
<div class="video-full">
<iframe
width="678"
height="408"
src={`https://www.youtube.com/embed/${id}?rel=0&iv_load_policy=3`}
frameborder="0"
allowfullscreen
>
</iframe>
<div class="video-full">
<iframe
width="678"
height="408"
src={`https://www.youtube.com/embed/${id}?rel=0&iv_load_policy=3`}
frameborder="0"
allowfullscreen
/>
</div>
</div>
</div>
)}
)
}

View file

@ -1,8 +1,8 @@
---
import AboutMe from '../components/AboutMe.astro'
import BaseLayout from './PageLayout.astro'
import DailyEmailForm from '../components/DailyEmailForm.astro'
import Markdown from '../components/Markdown.astro'
import AboutMe from "../components/AboutMe.astro";
import BaseLayout from "./PageLayout.astro";
import DailyEmailForm from "../components/DailyEmailForm.astro";
import Markdown from "../components/Markdown.astro";
const { title } = Astro.props.frontmatter || Astro.props;
---

View file

@ -1,76 +1,93 @@
---
import '../../assets/css/tailwind.pcss'
import "../../assets/css/tailwind.pcss";
import Navbar from '../components/Navbar.astro'
import Navbar from "../components/Navbar.astro";
export interface Props {
title: string;
title: string;
}
const { title } = Astro.props;
interface Link {
title: string,
href: string,
title: string;
href: string;
}
const footerLinks = [
{
title: 'About',
href: '/',
},
{
title: 'Blog',
href: '/blog',
},
{
title: 'Talks',
href: '/talks',
},
{
title: 'Daily list',
href: '/daily',
},
{
title: 'Search',
href: '/search',
},
]
title: "About",
href: "/",
},
{
title: "Blog",
href: "/blog",
},
{
title: "Talks",
href: "/talks",
},
{
title: "Daily list",
href: "/daily",
},
{
title: "Search",
href: "/search",
},
];
---
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto+Condensed:ital,wght@0,300;0,400;0,700;1,300&display=swap" rel="stylesheet">
<title>{title}</title>
<script defer data-domain="oliverdavies.uk" src="https://plausible.io/js/plausible.js"></script>
</head>
<body>
<div class="min-h-screen font-sans text-base font-light text-grey-900 md:text-xl dark:text-white dark:bg-grey-900">
<Navbar />
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<meta name="generator" content={Astro.generator} />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link
href="https://fonts.googleapis.com/css2?family=Roboto+Condensed:ital,wght@0,300;0,400;0,700;1,300&display=swap"
rel="stylesheet"
/>
<title>{title}</title>
<script
defer
data-domain="oliverdavies.uk"
src="https://plausible.io/js/plausible.js"
></script>
</head>
<body>
<div
class="min-h-screen font-sans text-base font-light text-grey-900 md:text-xl dark:text-white dark:bg-grey-900"
>
<Navbar />
<div class="py-10 px-4 mx-auto max-w-2xl md:py-10">
<h1 class="mb-4 text-xl font-bold md:text-2xl">{title}</h1>
<div class="py-10 px-4 mx-auto max-w-2xl md:py-10">
<h1 class="mb-4 text-xl font-bold md:text-2xl">{title}</h1>
<main>
<slot />
</main>
<main>
<slot />
</main>
<div class="mt-16 mb-6">
<footer>
<nav class="flex flex-wrap justify-center -mb-3">
{footerLinks && footerLinks.map(link => (
<a class="mx-3 mb-3 text-sm md:text-lg dark:text-white hover:text-grey-900 link dark:hover:text-blue-400" href={link.href}>{link.title}</a>
))}
</nav>
</footer>
</div>
</div>
</div>
</body>
<div class="mt-16 mb-6">
<footer>
<nav class="flex flex-wrap justify-center -mb-3">
{
footerLinks &&
footerLinks.map((link) => (
<a
class="mx-3 mb-3 text-sm md:text-lg dark:text-white hover:text-grey-900 link dark:hover:text-blue-400"
href={link.href}
>
{link.title}
</a>
))
}
</nav>
</footer>
</div>
</div>
</div>
</body>
</html>

View file

@ -1,12 +1,12 @@
---
import BaseLayout from './Layout.astro'
import Markdown from '../components/Markdown.astro'
import BaseLayout from "./Layout.astro";
import Markdown from "../components/Markdown.astro";
const { title } = Astro.props.frontmatter || Astro.props;
---
<BaseLayout title={title}>
<Markdown>
<slot/>
<slot />
</Markdown>
</BaseLayout>

View file

@ -1,39 +1,41 @@
---
import DailyEmailForm from '~/components/DailyEmailForm.astro'
import Layout from '~/layouts/DailyEmailLayout.astro'
import DailyEmailForm from "~/components/DailyEmailForm.astro";
import Layout from "~/layouts/DailyEmailLayout.astro";
export async function getStaticPaths({ paginate }) {
const emails = await Astro.glob('../../daily-emails/*.{md,mdx}')
const sortedEmails = emails
.sort((a, b) =>
const emails = await Astro.glob("../../daily-emails/*.{md,mdx}");
const sortedEmails = emails.sort(
(a, b) =>
new Date(b.frontmatter.pubDate).valueOf() -
new Date(a.frontmatter.pubDate).valueOf()
)
return paginate(sortedEmails, { pageSize: 20 })
);
return paginate(sortedEmails, { pageSize: 20 });
}
const { page } = Astro.props
const { page } = Astro.props;
---
<Layout title={'Daily email archive'}>
<Layout title={"Daily email archive"}>
<ul>
{page.data.map(email => (
<li>
<a href={`/${email.frontmatter.permalink}`}>
{new Date(email.frontmatter.pubDate).toLocaleDateString('en-GB', {
day: 'numeric',
month: 'long',
year: 'numeric',
})}:
{email.frontmatter.title}
</a>
</li>
))}
{
page.data.map((email) => (
<li>
<a href={`/${email.frontmatter.permalink}`}>
{new Date(email.frontmatter.pubDate).toLocaleDateString("en-GB", {
day: "numeric",
month: "long",
year: "numeric",
})}
:{email.frontmatter.title}
</a>
</li>
))
}
</ul>
<nav class="flex justify-center pt-10 space-x-6">
{ page.url.prev ? <a href={ page.url.prev }>&larr; Newer emails</a> : null }
{ page.url.next ? <a href={ page.url.next }>Older emails &rarr;</a> : null }
</nav>
<nav class="flex justify-center pt-10 space-x-6">
{page.url.prev ? <a href={page.url.prev}>&larr; Newer emails</a> : null}
{page.url.next ? <a href={page.url.next}>Older emails &rarr;</a> : null}
</nav>
</Layout>

View file

@ -1,34 +1,34 @@
---
import DailyEmailForm from '~/components/DailyEmailForm.astro'
import Layout from '~/layouts/DailyEmailLayout.astro'
import DailyEmailForm from "~/components/DailyEmailForm.astro";
import Layout from "~/layouts/DailyEmailLayout.astro";
export async function getStaticPaths() {
const emails = await Astro.glob('../../../../../daily-emails/*.{md,mdx}')
const emails = await Astro.glob("../../../../../daily-emails/*.{md,mdx}");
return emails.map(email => {
const pubDate = email.frontmatter.pubDate.split('T')[0].split('-')
return emails.map((email) => {
const pubDate = email.frontmatter.pubDate.split("T")[0].split("-");
const slug = email.frontmatter.permalink
.replace('archive/', '')
.replace('\n', '')
const slugParts = slug.split('/')
.replace("archive/", "")
.replace("\n", "");
const slugParts = slug.split("/");
return {
params: {
day: pubDate[2],
month: pubDate[1],
slug: slugParts.reverse()[0],
slug: slugParts.reverse()[0],
year: pubDate[0],
},
props: {
email,
}
}
})
},
};
});
}
const { Content } = Astro.props.email
const { title } = Astro.props.email.frontmatter
const { Content } = Astro.props.email;
const { title } = Astro.props.email.frontmatter;
---
<Layout title={title}>

View file

@ -1,25 +1,24 @@
---
import AboutMe from '~/components/AboutMe.astro'
import Layout from '~/layouts/Layout.astro'
import Markdown from '~/components/Markdown.astro'
import { getSlugFromFile } from '~/utils.ts'
import AboutMe from "~/components/AboutMe.astro";
import Layout from "~/layouts/Layout.astro";
import Markdown from "~/components/Markdown.astro";
import { getSlugFromFile } from "~/utils.ts";
export async function getStaticPaths() {
const posts = await Astro.glob('../../posts/*.md')
const posts = await Astro.glob("../../posts/*.md");
return posts
.map(post => {
const slug = getSlugFromFile(post.file)
return posts.map((post) => {
const slug = getSlugFromFile(post.file);
return {
params: { slug },
props: { post },
}
})
return {
params: { slug },
props: { post },
};
});
}
const { Content } = Astro.props.post
const { title } = Astro.props.post.frontmatter
const { Content } = Astro.props.post;
const { title } = Astro.props.post.frontmatter;
---
<Layout title={title}>

View file

@ -1,50 +1,60 @@
---
import PageLayout from '~/layouts/PageLayout.astro'
import { getSlugFromFile } from '~/utils.ts'
import PageLayout from "~/layouts/PageLayout.astro";
import { getSlugFromFile } from "~/utils.ts";
const posts = await Astro.glob("../../posts/*.md")
const posts = await Astro.glob("../../posts/*.md");
// TODO: show all posts when running locally.
const filteredPosts = posts
.filter(post => !post.frontmatter.draft)
.filter(post => post.frontmatter.date)
.filter((post) => !post.frontmatter.draft)
.filter((post) => post.frontmatter.date);
const sortedPosts = filteredPosts
.map(post => {
const slug = getSlugFromFile(post.file)
.map((post) => {
const slug = getSlugFromFile(post.file);
return { post, slug }
return { post, slug };
})
.sort((a, b) =>
new Date(b.post.frontmatter.date).valueOf() -
.sort(
(a, b) =>
new Date(b.post.frontmatter.date).valueOf() -
new Date(a.post.frontmatter.date).valueOf()
)
);
---
<PageLayout title="Blog">
<p>This is where I publish my personal blog posts as well as technical posts and tutorials on topics such as Drupal, PHP, Tailwind CSS, automated testing, and systems administration. </p>
<p>
This is where I publish my personal blog posts as well as technical posts
and tutorials on topics such as Drupal, PHP, Tailwind CSS, automated
testing, and systems administration.
</p>
<div>
{sortedPosts.map((post) => (
<article>
<a href=`/blog/${post.slug}`>
<h2>{post.post.frontmatter.title}</h2>
</a>
{
sortedPosts.map((post) => (
<article>
<a href={`/blog/${post.slug}`}>
<h2>{post.post.frontmatter.title}</h2>
</a>
{post.post.frontmatter.date && (
<time class="text-base" datetime={post.post.frontmatter.date}>
{new Date(post.post.frontmatter.date).toLocaleDateString('en-GB', {
day: 'numeric',
month: 'long',
year: 'numeric',
})}
</time>
)}
{post.post.frontmatter.date && (
<time class="text-base" datetime={post.post.frontmatter.date}>
{new Date(post.post.frontmatter.date).toLocaleDateString(
"en-GB",
{
day: "numeric",
month: "long",
year: "numeric",
}
)}
</time>
)}
<div class="mt-1">
<p>{post.post.frontmatter.excerpt}</p>
</div>
</article>
))}
<div class="mt-1">
<p>{post.post.frontmatter.excerpt}</p>
</div>
</article>
))
}
</div>
</PageLayout>

View file

@ -1,21 +1,34 @@
---
import PageLayout from '~/layouts/PageLayout.astro'
import PageLayout from "~/layouts/PageLayout.astro";
const commonSearches = [
'Drupal',
'Test-Driven Development',
'Tailwind CSS',
'Ansible',
'Ansistrano',
]
"Drupal",
"Test-Driven Development",
"Tailwind CSS",
"Ansible",
"Ansistrano",
];
---
<PageLayout title="Search">
<div>
<form action="https://www.google.com/search" method="get">
<input type="hidden" name="q" value="site:https://www.oliverdavies.uk">
<input type="text" name="q" alt="search">
<input type="submit" value="Search">
<form
class="flex items-center space-x-6"
action="https://www.google.com/search"
method="get"
>
<div class="flex-1">
<input
type="hidden"
name="q"
value="site:https://www.oliverdavies.uk"
/>
<input class="w-full" type="text" name="q" alt="search" />
</div>
<div>
<input class="button cursor-pointer" type="submit" value="Search" />
</div>
</form>
</div>
@ -23,13 +36,17 @@ const commonSearches = [
<h2>Common searches</h2>
<ul>
{commonSearches.map(search => (
<li>
<a href=`https://www.google.com/search?q=site%3Awww.oliverdavies.uk+%22${search}%22`>
{search}
</a>
</li>
))}
{
commonSearches.map((search) => (
<li>
<a
href={`https://www.google.com/search?q=site%3Awww.oliverdavies.uk+%22${search}%22`}
>
{search}
</a>
</li>
))
}
</ul>
</aside>
</PageLayout>

View file

@ -1,27 +1,27 @@
---
import AboutMe from '~/components/AboutMe.astro'
import Events from '~/components/talk/Events.astro'
import Layout from '~/layouts/Layout.astro'
import Markdown from '~/components/Markdown.astro'
import Slides from '~/components/talk/Slides.astro'
import Video from '~/components/talk/Video.astro'
import { getSlugFromFile } from '~/utils.ts'
import AboutMe from "~/components/AboutMe.astro";
import Events from "~/components/talk/Events.astro";
import Layout from "~/layouts/Layout.astro";
import Markdown from "~/components/Markdown.astro";
import Slides from "~/components/talk/Slides.astro";
import Video from "~/components/talk/Video.astro";
import { getSlugFromFile } from "~/utils.ts";
export async function getStaticPaths() {
const talks = await Astro.glob('../../talks/*.md')
const talks = await Astro.glob("../../talks/*.md");
return talks.map(talk => {
const slug = getSlugFromFile(talk.file)
return talks.map((talk) => {
const slug = getSlugFromFile(talk.file);
return {
params: { slug },
props: { talk }
}
})
props: { talk },
};
});
}
const { Content } = Astro.props.talk
const { events, speakerdeck, title, video } = Astro.props.talk.frontmatter
const { Content } = Astro.props.talk;
const { events, speakerdeck, title, video } = Astro.props.talk.frontmatter;
---
<Layout title={title}>
@ -30,13 +30,9 @@ const { events, speakerdeck, title, video } = Astro.props.talk.frontmatter
<Content />
</Markdown>
{speakerdeck && (
<Slides id={speakerdeck.id} ratio={speakerdeck.ratio} />
)}
{speakerdeck && <Slides id={speakerdeck.id} ratio={speakerdeck.ratio} />}
{video && (
<Video id={video.id} type={video.type} />
)}
{video && <Video id={video.id} type={video.type} />}
<Events events={events} />

View file

@ -1,43 +1,50 @@
---
import PageLayout from '~/layouts/PageLayout.astro'
import _ from 'lodash'
import { getSlugFromFile } from '~/utils.ts'
import PageLayout from "~/layouts/PageLayout.astro";
import _ from "lodash";
import { getSlugFromFile } from "~/utils.ts";
const talks = await Astro.glob("../../talks/*.md")
const talks = await Astro.glob("../../talks/*.md");
const talkCount = _(talks)
.flatMap((talk) => talk.frontmatter.events)
.size()
.size();
const sortedTalks = talks
.map(talk => {
const slug = getSlugFromFile(talk.file)
.map((talk) => {
const slug = getSlugFromFile(talk.file);
return { slug, talk }
return { slug, talk };
})
.sort((b, a) => {
const events = [
a.talk.frontmatter.events[a.talk.frontmatter.events.length - 1],
b.talk.frontmatter.events[b.talk.frontmatter.events.length - 1],
]
];
return new Date(events[0].date).valueOf() -
new Date(events[1].date).valueOf()
})
return (
new Date(events[0].date).valueOf() - new Date(events[1].date).valueOf()
);
});
---
<PageLayout title="Talks and workshops">
<p>Starting with my first talk in September 2012, I have given {talkCount} presentations and workshops at various conferences and meetups, in-person and remotely, on topics including PHP, Drupal, automated testing, Git, CSS, and systems administration.</p>
<p>
Starting with my first talk in September 2012, I have given {talkCount} presentations
and workshops at various conferences and meetups, in-person and remotely, on
topics including PHP, Drupal, automated testing, Git, CSS, and systems administration~
<div>
{sortedTalks.map((talk) => (
<article>
<a href=`/talks/${talk.slug}`>
<h2>{talk.talk.frontmatter.title}</h2>
</a>
<div>
{
sortedTalks.map((talk) => (
<article>
<a href={`/talks/${talk.slug}`}>
<h2>{talk.talk.frontmatter.title}</h2>
</a>
{talk.talk.frontmatter.description}
</article>
))}
</div>
{talk.talk.frontmatter.description}
</article>
))
}
</div>
</p>
</PageLayout>