chore: run prettier on Astro files
This commit is contained in:
parent
a489a2ca02
commit
40d8e58cce
17 changed files with 1005 additions and 330 deletions
|
|
@ -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 }>← Newer emails</a> : null }
|
||||
{ page.url.next ? <a href={ page.url.next }>Older emails →</a> : null }
|
||||
</nav>
|
||||
<nav class="flex justify-center pt-10 space-x-6">
|
||||
{page.url.prev ? <a href={page.url.prev}>← Newer emails</a> : null}
|
||||
{page.url.next ? <a href={page.url.next}>Older emails →</a> : null}
|
||||
</nav>
|
||||
</Layout>
|
||||
|
|
|
|||
|
|
@ -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}>
|
||||
|
|
|
|||
|
|
@ -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}>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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} />
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue