summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoe Carstairs <65492573+joeacarstairs@users.noreply.github.com>2025-01-06 21:49:17 +0000
committerGitHub <noreply@github.com>2025-01-06 21:49:17 +0000
commit9fb9e47e92049b72cdc7cbaa3e9d43ed1aacd095 (patch)
treea2069f3d255f8dddc0102afbc8283d79101045b7 /src
parentf4875fd98fd502c19ca093e4bfeed386d174ed86 (diff)
parent7d377d5794e92d0d06d3db19d398bb6f81802b5f (diff)
Merge pull request #109 from joeacarstairs/staging
Update
Diffstat (limited to 'src')
-rw-r--r--src/content.config.ts (renamed from src/content/config.ts)5
-rw-r--r--src/content/news/en-GB/2025-01-06-sam-gilliland.mdx9
-rw-r--r--src/content/news/sco/2025-01-06-sam-gilliland.mdx9
-rw-r--r--src/lib/newsUtils.ts2
-rw-r--r--src/pages/[locale]/news/[...slug].astro4
5 files changed, 24 insertions, 5 deletions
diff --git a/src/content/config.ts b/src/content.config.ts
index 599c570..af3f25d 100644
--- a/src/content/config.ts
+++ b/src/content.config.ts
@@ -1,7 +1,8 @@
+import { glob } from 'astro/loaders';
import { defineCollection, z } from 'astro:content';
const news = defineCollection({
- type: 'content',
+ loader: glob({ pattern: '**/*.(md|mdx|html)', base: './src/content/news' }),
schema: z.object({
title: z.string(),
summary: z.string(),
@@ -9,5 +10,5 @@ const news = defineCollection({
});
export const collections = {
- news: news,
+ news,
};
diff --git a/src/content/news/en-GB/2025-01-06-sam-gilliland.mdx b/src/content/news/en-GB/2025-01-06-sam-gilliland.mdx
new file mode 100644
index 0000000..2e4ac6f
--- /dev/null
+++ b/src/content/news/en-GB/2025-01-06-sam-gilliland.mdx
@@ -0,0 +1,9 @@
+---
+title: Sam Gilliland
+summary: Sam Gilliland has died.
+---
+
+We learned last week that Sam Gilliland has died. He won this Society's Hugh MacDiarmaid Tassie for
+his poetry in 2009, and published a number of poetry collections, including _A Rickle o Banes_
+(Penny Wheep Press, 2009). He also organised the Scottish International Open Poetry Competition for
+well over two decades. Our condolences go to his family.
diff --git a/src/content/news/sco/2025-01-06-sam-gilliland.mdx b/src/content/news/sco/2025-01-06-sam-gilliland.mdx
new file mode 100644
index 0000000..fc30813
--- /dev/null
+++ b/src/content/news/sco/2025-01-06-sam-gilliland.mdx
@@ -0,0 +1,9 @@
+---
+title: Sam Gilliland
+summary: Sam Gilliland haes deed.
+---
+
+We lairned lest ouk that Sam Gilliland haes deed. He won this Society's Hugh MacDiarmaid Tassie for
+his poesie in 2009, and furthset a wheen o collections, sic as _A Rickle o Banes_ (Penny Wheep
+Press, 2009). Forby, he organised the Scottish International Open Poetry Competition for weill ower
+twa decades. Our condolences gang til his faimly.
diff --git a/src/lib/newsUtils.ts b/src/lib/newsUtils.ts
index bffc7d6..233fdcf 100644
--- a/src/lib/newsUtils.ts
+++ b/src/lib/newsUtils.ts
@@ -25,7 +25,7 @@ export function getHref(newsItem: CollectionEntry<'news'>) {
export function getSlug(newsItem: CollectionEntry<'news'>) {
const toLowerCase = (s: string) => s.toLowerCase();
const matchLocales = new RegExp(`(${locales.map(toLowerCase).join('|')})/`);
- return newsItem.slug.replace(matchLocales, '');
+ return newsItem.id.replace(matchLocales, '');
}
export function isNewsItemInLocale(newsItem: CollectionEntry<'news'>, locale: Locale) {
diff --git a/src/pages/[locale]/news/[...slug].astro b/src/pages/[locale]/news/[...slug].astro
index a24e65a..4585cf2 100644
--- a/src/pages/[locale]/news/[...slug].astro
+++ b/src/pages/[locale]/news/[...slug].astro
@@ -1,6 +1,6 @@
---
import Article from '$layouts/Article.astro';
-import { getCollection } from 'astro:content';
+import { getCollection, render } from 'astro:content';
import { getLocale, getSlug } from '$lib/newsUtils';
export async function getStaticPaths() {
@@ -14,7 +14,7 @@ export async function getStaticPaths() {
}
const { entry } = Astro.props;
-const { Content } = await entry.render();
+const { Content } = await render(entry);
---
<Article title={entry.data.title}>