add carbon rating
This commit is contained in:
@@ -13,4 +13,7 @@ interface Props {}
|
||||
<p>
|
||||
<a href="/rss.xml"> Subscribe with RSS</a>
|
||||
</p>
|
||||
<div id="wcb" class="carbonbadge"></div>
|
||||
</footer>
|
||||
<script src="https://unpkg.com/website-carbon-badges@1.1.3/b.min.js" defer
|
||||
></script>
|
||||
|
||||
@@ -6,6 +6,12 @@ const { pathname } = Astro.url;
|
||||
|
||||
interface Props {}
|
||||
|
||||
interface NavLink {
|
||||
label: string;
|
||||
icon: string;
|
||||
path: string;
|
||||
}
|
||||
|
||||
const navLinks: NavLink[] = [
|
||||
{ label: 'Blog', icon: 'pen', path: '/' },
|
||||
{ label: 'About', icon: 'person', path: '/about/' },
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { z, defineCollection } from 'astro:content';
|
||||
import { Tag } from 'src/types';
|
||||
|
||||
const blogCollection = defineCollection({
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
pubDate: z.string().transform((str: string) => new Date(str)),
|
||||
tags: z.array(z.nativeEnum(Tag)),
|
||||
tags: z.array(z.string()),
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
---
|
||||
import { format, add } from 'date-fns';
|
||||
import { getCollection } from 'astro:content';
|
||||
import { Tag as TagEnum } from '../../types';
|
||||
|
||||
import Layout from '@layouts/Layout.astro';
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
const { tag }: { tag?: TagEnum } = Astro.params;
|
||||
const { tag }: { tag?: string } = Astro.params;
|
||||
|
||||
const posts = await getCollection('blog', ({ data }) => {
|
||||
if (!tag) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tag === TagEnum.all) {
|
||||
if (tag === 'all') {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
// navigation links
|
||||
export type NavLink = {
|
||||
label: string;
|
||||
icon: string;
|
||||
path: string;
|
||||
};
|
||||
|
||||
// blog tags
|
||||
export enum Tag {
|
||||
'Apps' = 'Apps',
|
||||
'Digital Life' = 'Digital Life',
|
||||
'Gaming' = 'Gaming',
|
||||
'Learning' = 'Learning',
|
||||
'Life' = 'Life',
|
||||
'MacOS' = 'MacOS',
|
||||
'Music' = 'Music',
|
||||
'Making Stuff' = 'Making Stuff',
|
||||
'Mental Health' = 'Mental Health',
|
||||
'Movies & TV' = 'Movies & TV',
|
||||
'Programming' = 'Programming',
|
||||
'Tech' = 'Tech',
|
||||
'Tutorial' = 'Tutorial',
|
||||
'Web Dev' = 'Web Dev',
|
||||
// only for filtering
|
||||
all = 'all',
|
||||
}
|
||||
Reference in New Issue
Block a user