rss and blog/project headers
This commit is contained in:
parent
97027c9ac6
commit
e5ad5b77f4
|
@ -7,6 +7,10 @@
|
||||||
{
|
{
|
||||||
"title": "blog",
|
"title": "blog",
|
||||||
"path": "[[workspace]]/src/content/posts"
|
"path": "[[workspace]]/src/content/posts"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "projects",
|
||||||
|
"path": "[[workspace]]/src/content/projects"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"frontMatter.taxonomy.contentTypes": [
|
"frontMatter.taxonomy.contentTypes": [
|
||||||
|
@ -53,6 +57,60 @@
|
||||||
"type": "tags"
|
"type": "tags"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "project",
|
||||||
|
"pageBundle": false,
|
||||||
|
"previewPath": "'projects'",
|
||||||
|
"filePrefix": null,
|
||||||
|
"clearEmpty": true,
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"title": "Name",
|
||||||
|
"name": "name",
|
||||||
|
"type": "string",
|
||||||
|
"single": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Description",
|
||||||
|
"name": "description",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "URL",
|
||||||
|
"name": "url",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Publishing date",
|
||||||
|
"name": "pubDate",
|
||||||
|
"type": "datetime",
|
||||||
|
"default": "{{now}}",
|
||||||
|
"isPublishDate": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Hero image",
|
||||||
|
"name": "heroImage",
|
||||||
|
"type": "image",
|
||||||
|
"isPreviewImage": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Tags",
|
||||||
|
"name": "tags",
|
||||||
|
"type": "tags"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Featured",
|
||||||
|
"name": "featured",
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Link only",
|
||||||
|
"name": "linkOnly",
|
||||||
|
"type": "boolean"
|
||||||
|
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -16,6 +16,7 @@ const projects = defineCollection({
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
description: z.string(),
|
description: z.string(),
|
||||||
url: z.string(),
|
url: z.string(),
|
||||||
|
pubDate: z.coerce.date(),
|
||||||
heroImage: z.string().optional(),
|
heroImage: z.string().optional(),
|
||||||
tags: z.array(z.string()).optional(),
|
tags: z.array(z.string()).optional(),
|
||||||
featured: z.boolean().optional(),
|
featured: z.boolean().optional(),
|
||||||
|
|
|
@ -8,6 +8,8 @@ tags:
|
||||||
- nlp
|
- nlp
|
||||||
- linguistics
|
- linguistics
|
||||||
- library
|
- library
|
||||||
|
pubDate: 2023-12-08T18:06:53.000Z
|
||||||
heroImage: /images/cadmium-header.png
|
heroImage: /images/cadmium-header.png
|
||||||
linkOnly: true
|
linkOnly: true
|
||||||
|
type: project
|
||||||
---
|
---
|
||||||
|
|
|
@ -7,8 +7,10 @@ tags:
|
||||||
- rust
|
- rust
|
||||||
- server
|
- server
|
||||||
- self-hosted
|
- self-hosted
|
||||||
|
pubDate: 2023-12-08T18:06:49.000Z
|
||||||
featured: true
|
featured: true
|
||||||
heroImage: /images/inkify-header.webp
|
heroImage: /images/inkify-header.webp
|
||||||
|
type: project
|
||||||
---
|
---
|
||||||
|
|
||||||
import CodeToImg from '../../components/inkify/CodeToImg.vue'
|
import CodeToImg from '../../components/inkify/CodeToImg.vue'
|
||||||
|
|
|
@ -10,5 +10,7 @@ tags:
|
||||||
- webdriver
|
- webdriver
|
||||||
linkOnly: true
|
linkOnly: true
|
||||||
featured: true
|
featured: true
|
||||||
|
pubDate: 2023-12-08T18:06:45.000Z
|
||||||
heroImage: /images/marionette-header.webp
|
heroImage: /images/marionette-header.webp
|
||||||
|
type: project
|
||||||
---
|
---
|
||||||
|
|
|
@ -8,6 +8,8 @@ tags:
|
||||||
- crystal
|
- crystal
|
||||||
- bot
|
- bot
|
||||||
- framework
|
- framework
|
||||||
|
pubDate: 2023-12-08T18:06:35.000Z
|
||||||
heroImage: /images/tourmaline-header.png
|
heroImage: /images/tourmaline-header.png
|
||||||
linkOnly: true
|
linkOnly: true
|
||||||
|
type: project
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
---
|
---
|
||||||
|
import { Icon } from 'astro-icon/components';
|
||||||
import BaseHead from '../../components/BaseHead.astro';
|
import BaseHead from '../../components/BaseHead.astro';
|
||||||
import Header from '../../components/Header.astro';
|
import Header from '../../components/Header.astro';
|
||||||
import Footer from '../../components/Footer.astro';
|
import Footer from '../../components/Footer.astro';
|
||||||
|
@ -19,6 +20,9 @@ const posts = (await getCollection('posts')).sort(
|
||||||
main {
|
main {
|
||||||
width: 960px;
|
width: 960px;
|
||||||
}
|
}
|
||||||
|
h1 {
|
||||||
|
@apply flex items-center justify-center mb-12 gap-4;
|
||||||
|
}
|
||||||
ul {
|
ul {
|
||||||
@apply flex flex-wrap gap-8 list-none m-0 p-0;
|
@apply flex flex-wrap gap-8 list-none m-0 p-0;
|
||||||
}
|
}
|
||||||
|
@ -76,6 +80,12 @@ const posts = (await getCollection('posts')).sort(
|
||||||
<Header />
|
<Header />
|
||||||
<main>
|
<main>
|
||||||
<section>
|
<section>
|
||||||
|
<h1>
|
||||||
|
<span>Blog</span>
|
||||||
|
<a target="_blank" href="/posts/rss.xml">
|
||||||
|
<Icon name="mdi:rss" />
|
||||||
|
</a>
|
||||||
|
</h1>
|
||||||
<ul>
|
<ul>
|
||||||
{
|
{
|
||||||
posts
|
posts
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import rss from '@astrojs/rss';
|
import rss from '@astrojs/rss';
|
||||||
import { getCollection } from 'astro:content';
|
import { getCollection } from 'astro:content';
|
||||||
import { SITE_TITLE, SITE_DESCRIPTION } from '../consts';
|
import { SITE_TITLE, SITE_DESCRIPTION } from '../../consts';
|
||||||
|
|
||||||
export async function GET(context) {
|
export async function GET(context) {
|
||||||
const posts = await getCollection('posts');
|
const posts = await getCollection('posts');
|
|
@ -1,4 +1,5 @@
|
||||||
---
|
---
|
||||||
|
import { Icon } from 'astro-icon/components';
|
||||||
import BaseHead from '../../components/BaseHead.astro';
|
import BaseHead from '../../components/BaseHead.astro';
|
||||||
import Header from '../../components/Header.astro';
|
import Header from '../../components/Header.astro';
|
||||||
import Footer from '../../components/Footer.astro';
|
import Footer from '../../components/Footer.astro';
|
||||||
|
@ -22,6 +23,9 @@ const projects = (await getCollection('projects'))
|
||||||
main {
|
main {
|
||||||
width: 960px;
|
width: 960px;
|
||||||
}
|
}
|
||||||
|
h1 {
|
||||||
|
@apply flex items-center justify-center mb-12 gap-4;
|
||||||
|
}
|
||||||
ul {
|
ul {
|
||||||
@apply flex flex-wrap gap-8 list-none m-0 p-0;
|
@apply flex flex-wrap gap-8 list-none m-0 p-0;
|
||||||
}
|
}
|
||||||
|
@ -74,6 +78,12 @@ const projects = (await getCollection('projects'))
|
||||||
<body>
|
<body>
|
||||||
<Header />
|
<Header />
|
||||||
<main>
|
<main>
|
||||||
|
<h1>
|
||||||
|
<span>Projects</span>
|
||||||
|
<a target="_blank" href="/projects/rss.xml">
|
||||||
|
<Icon name="mdi:rss" />
|
||||||
|
</a>
|
||||||
|
</h1>
|
||||||
<section>
|
<section>
|
||||||
<ul>
|
<ul>
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
import rss from '@astrojs/rss';
|
||||||
|
import { getCollection } from 'astro:content';
|
||||||
|
import { SITE_TITLE, SITE_DESCRIPTION } from '../../consts';
|
||||||
|
|
||||||
|
export async function GET(context) {
|
||||||
|
const projects = await getCollection('projects');
|
||||||
|
return rss({
|
||||||
|
title: SITE_TITLE,
|
||||||
|
description: SITE_DESCRIPTION,
|
||||||
|
site: context.site,
|
||||||
|
items: projects.map((project) => ({
|
||||||
|
title: project.data.name,
|
||||||
|
pubDate: project.data.pubDate,
|
||||||
|
link: project.data.linkOnly ? project.data.url : `/projects/${project.slug}/`,
|
||||||
|
})),
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in New Issue