This commit is contained in:
matthieu42morin 2024-02-13 16:46:15 +01:00
parent a4620a399a
commit 63b6bccf94
7 changed files with 57 additions and 36 deletions

View File

@ -2,17 +2,6 @@ import type { MarkdownMetadata, MdsvexImport } from './types';
import { parseReadContent } from './utils';
import { error } from '@sveltejs/kit';
export interface Project extends MarkdownMetadata {
title: string;
excerpt: string;
slug: string;
image: string;
date: string;
pageTitle: string;
pageDescription: string;
keywords: string;
}
/**
* Gets all the projects metadata
*/

View File

@ -5,15 +5,18 @@ type Skill = {
// prettier-ignore
const skills: Skill[] = [
{title:'Langs/Frameworks', list: ['Svelte', 'SvelteKit', 'JavaScript/TypeScript', 'Python', 'C/C++']},
{title:'Devops', list: ['Git', 'Terraform', 'Ansible', 'Docker', 'Docker Compose', 'K8s']},
{title:'Langs', list: ['JavaScript/TypeScript', 'Python', 'a bit of C/C++', 'Bash', 'SQL', '...']},
{title:'Frontend', list: ['Svelte', 'SvelteKit']},
{title:'Devops', list: ['Git', 'Terraform', 'Ansible', 'Docker', 'Docker Compose', 'K8s', 'Grafana']},
{title:'CI/CD', list: ['GitHub Actions', 'Gitea Actors', 'Gitlab', 'SFTP', ]},
{title:'Linux', list: ['Debian', 'Ubuntu', 'Arch Linux', 'Alpine', 'Raspbian']},
{title:'SysAdmin', list: ['Systemd', 'nginx', 'User acc management', 'basic networking tools, ...']},
{title:'Databases', list: ['PostgreSQL', 'MariaDB', 'SQLite' ]},
{title:'Cloud', list: ['AWS', 'Azure', 'DigitalOcean', 'Vercel', 'Hetzner Cloud']},
{title:'Cloud', list: ['AWS', 'Azure', 'Cloudflare', 'DigitalOcean', 'Vercel', 'Hetzner Cloud']},
{title:'IoT', list: ['Raspberry Pi', 'Arduino', 'ESP32', 'ESP8266', '...sensors', 'MQTT', 'LoRa', 'BLE', 'NFC', 'WiFi', ]},
{title:'other tools', list: ['HC Vault / AWS Secrets Manager', 'AWS Lambda']},
{title:'Languages', list: ['English', 'Czech', 'French', 'German']},
{title:'other', list: ['Figma', 'UI/UX', 'Wireframing', 'Prototyping', 'Adobe InDesign, Illustrator, Inkscape, ...',]}
{title:'design', list: ['Figma', 'UI/UX', 'Wireframing', 'Prototyping', 'Adobe InDesign, Illustrator, Inkscape, ...',]}
];
export default skills;

View File

@ -1,7 +1,7 @@
import { listProjects } from '$content/projects';
import type { LayoutServerLoad } from './$types';
export const load: LayoutServerLoad = () => {
export const load = () => {
return {
projects: listProjects()
};

View File

@ -1,11 +1,23 @@
<script lang="ts">
import type { PageData } from './$types';
import PostPreview from '$lib/components/blog/PostPreview.svelte';
export let data: PageData;
</script>
<div class="projects-layout">
{data.projects}
<div class="space-y-8">
<header class="flex flex-col justify-center items-center">
<h1 class="h1 m-4">Projects</h1>
</header>
<div
class="grid m-auto max-w-7xl w-full gap-6 grid-cols-none justify-center md:grid-cols-2 lg:grid-cols-3"
>
{#each data.projects as post}
<div class="flex justify-center min-w-[20rem] max-w-sm">
<PostPreview {post} type="blog" isMostRecent />
</div>
{/each}
</div>
</div>
<style lang="postcss">

View File

@ -0,0 +1,27 @@
import { listProjects } from '$content/projects';
import { error } from '@sveltejs/kit';
function shuffle<T>(array: T[]) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
}
export async function load({ params }) {
const posts = listProjects();
const currentPost = posts.find((post) => post.slug == params.slug);
if (!currentPost) {
throw error(404, `Unable to find blog post "${params.slug}"`);
}
shuffle(posts);
return {
featuredPosts: posts
.filter((post) => post.slug != params.slug)
.filter((p) => p.tags?.some((t) => currentPost.tags?.includes(t)))
.slice(0, 3)
};
}

View File

@ -1,5 +1,5 @@
<script lang="ts">
import ProjectsContentLayout from '$lib/components/projects/projects-content-layout.svelte';
import ProjectsContentLayout from '$lib/components/projects/ProjectsContentLayout.svelte';
import type { PageData } from './$types';
export let data: PageData;

View File

@ -1,5 +1,4 @@
import { removeTrailingSlash } from '$lib/utils/helpers';
import type { RequestHandler } from './$types';
import { listBlogPosts } from '$content/blog';
// prettier-ignore
@ -16,10 +15,10 @@ const sitemap = (pages: string[]) => `<?xml version="1.0" encoding="UTF-8" ?>
</urlset>
`;
export const GET: RequestHandler = async () => {
export const GET = async () => {
const staticPages = Object.keys(
// For other static pages. Except content pages - changelogs, guides, blog posts, guides etc.
import.meta.glob('/src/routes/**/!(_)*.{svelte,md}'),
import.meta.glob('/src/routes/**/!(_)*.{svelte,md,svx}')
)
.filter((page) => {
const filters = [
@ -28,14 +27,10 @@ export const GET: RequestHandler = async () => {
'404',
'slug]',
'title]',
'src/routes/docs/introduction/getting-started',
'extension-activation',
'unsubscribe',
'subscribe',
'stay-connected',
'extension-uninstall',
'+error',
'+layout',
'+layout'
];
return !filters.find((filter) => page.includes(filter));
})
@ -49,18 +44,13 @@ export const GET: RequestHandler = async () => {
.replace('/+page', '');
});
const blogPosts = listBlogPosts().map(
(post) => `https://www.gitpod.io/blog/${post.slug}`,
);
const renderedSitemap = sitemap([
...staticPages,
...blogPosts,
]);
const blogPosts = listBlogPosts().map((post) => `https://www.mattmor.in/blog/${post.slug}`);
const renderedSitemap = sitemap([...staticPages, ...blogPosts]);
return new Response(renderedSitemap, {
headers: {
'Cache-Control': 'max-age=0, s-maxage=3600',
'Content-Type': 'application/xml',
},
'Content-Type': 'application/xml'
}
});
};