Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new version and design #68

Merged
merged 37 commits into from
Jan 19, 2024
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
689802d
Update about section in English and Spanish translations
Michael-Liendo Jan 17, 2024
40707bb
Update user main design
Michael-Liendo Jan 17, 2024
5c2b1bf
Update main container padding
Michael-Liendo Jan 17, 2024
ff7413b
Refactor SocialMedia component
Michael-Liendo Jan 17, 2024
e5e4f6e
Add schema.org metadata to +page.svelte
Michael-Liendo Jan 17, 2024
99c2764
create a Bentogrids and create the design for the first item
Michael-Liendo Jan 17, 2024
3bed6c6
chore: add 2 item of the bento grid
Michael-Liendo Jan 17, 2024
20c683d
create the 3 item of the grid
Michael-Liendo Jan 17, 2024
f0624ae
Update styling for note cards
Michael-Liendo Jan 17, 2024
ff17606
Fix note links in +page.svelte
Michael-Liendo Jan 17, 2024
cae9766
Update SocialMedia and +page components
Michael-Liendo Jan 17, 2024
105c381
Add title attribute to dark mode button
Michael-Liendo Jan 17, 2024
1e67e2d
Update copyright year in footer
Michael-Liendo Jan 17, 2024
77764e3
Update note URLs in +page.svelte
Michael-Liendo Jan 18, 2024
2b0bb7f
Refactor page layout and metadata in notes component
Michael-Liendo Jan 18, 2024
1aee7b7
Update styling in +page and +page notes
Michael-Liendo Jan 18, 2024
32cf363
Remove unused imports and update meta tags in +page.svelte
Michael-Liendo Jan 18, 2024
dcea0f9
Update Header and Page styles
Michael-Liendo Jan 18, 2024
9c0b62c
Update background color in page links
Michael-Liendo Jan 18, 2024
8cc4722
Update font size and margin in homepage notes section
Michael-Liendo Jan 18, 2024
ca9a4fa
Update package.json version to 5.0.0
Michael-Liendo Jan 18, 2024
83a3d4f
Capacity on main route
Michael-Liendo Jan 18, 2024
3e84bf1
Refactor language selection links in Header.svelte and +page.svelte
Michael-Liendo Jan 19, 2024
07e1c44
Add Notion service and client code
Michael-Liendo Jan 19, 2024
703d402
Update import paths for Note types
Michael-Liendo Jan 19, 2024
c855ab6
Add type definitions for ProjectResponse and update project transformer
Michael-Liendo Jan 19, 2024
d6ee7f5
Refactor Entry and projects page components
Michael-Liendo Jan 19, 2024
6f0a8f6
Update layout styles in notes and projects pages
Michael-Liendo Jan 19, 2024
6e0ffe1
Refactor Entry component and note list layout
Michael-Liendo Jan 19, 2024
7bc3110
Update import statement in sitemap.xml server file
Michael-Liendo Jan 19, 2024
f77c060
Update sitemap routes
Michael-Liendo Jan 19, 2024
451a7e0
Update font size in homepage section
Michael-Liendo Jan 19, 2024
e57e331
Update language settings
Michael-Liendo Jan 19, 2024
5d72933
Update i18n-util imports and use baseLocale
Michael-Liendo Jan 19, 2024
965b056
Add new routes to sitemap.xml server file
Michael-Liendo Jan 19, 2024
15e5ffd
Refactor sitemap generation and add support for multiple languages
Michael-Liendo Jan 19, 2024
b22b362
Swap notesSlugsEn and notesSlugsEs in generateRoutes function
Michael-Liendo Jan 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Capacity on main route
Michael-Liendo committed Jan 18, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 83a3d4ffa84393b46a07d55c805ee34c3ecd564f
12 changes: 1 addition & 11 deletions src/hooks.server.ts
Original file line number Diff line number Diff line change
@@ -13,18 +13,8 @@ export const handle: Handle = async ({ event, resolve }) => {
// read language slug
const [, lang] = event.url.pathname.split('/');

// redirect to base locale if no locale slug was found
if (!lang) {
const locale = getPreferredLocale(event);

return new Response(null, {
status: 302,
headers: { Location: `/${locale}` },
});
}

// if slug is not a locale, use base locale (e.g. api endpoints)
const locale = isLocale(lang) ? (lang as Locales) : getPreferredLocale(event);
const locale = isLocale(lang) ? (lang as Locales) : 'es';
const LL = L[locale];

// bind locale and translation functions to current request
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import type { Note } from '$lib/utils/Notion/Notes/types.js';

/** @type {import('./$types').PageLoad} */
export async function load({ params, fetch }) {
const res = await fetch(`/api/notes/${params.lang}`);
const res = await fetch(`/api/notes/${params.lang ?? 'es'}`);

if (res.ok) {
const notes = await res.json();
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import type { Note } from '$lib/utils/Notion/Notes/types.js';

/** @type {import('./$types').PageLoad} */
export async function load({ params, fetch }) {
const res = await fetch(`/api/notes/${params.lang}`);
const res = await fetch(`/api/notes/${params.lang ?? 'es'}`);

if (res.ok) {
const notes = await res.json();
Original file line number Diff line number Diff line change
@@ -4,7 +4,9 @@ import { error } from '@sveltejs/kit';
/** @type {import('./$types').PageLoad} */
export async function load({ params, fetch }) {
try {
const request = await fetch(`/api/note/${params.lang}/${params.slug}`);
const request = await fetch(
`/api/note/${params.lang ?? 'es'}/${params.slug}`,
);
const note = await request.json();

if (!note.note) {
73 changes: 73 additions & 0 deletions src/routes/[[lang=lang]]/projects/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<script lang="ts">
import { locale } from '$i18n/i18n-svelte';
import Entry from '$lib/components/Entry.svelte';

export let data: {
projects: any[];
};

let title = 'Projects | Michael Liendo';
let description =
'projects taken while reading about computer science and software development.';
let keywords =
'projects, blog, articles, writing, content, topics, tips, insights, experiences, knowledge';
let avatarUrl = 'https://avatars.githubusercontent.com/u/70660410?v=4';

$: {
switch ($locale) {
case 'en':
title = 'Projects | Michael Liendo';
description =
'projects taken while reading about computer science and software development.';
keywords =
'projects, blog, articles, writing, content, topics, tips, insights, experiences, knowledge';
break;
case 'es':
title = 'Proyectos | Michael Liendo';
description =
'Notas tomadas mientras leo sobre ciencias de la computación y desarrollo de software.';
keywords =
'notas, blog, artículos, escritura, contenido, temas, consejos, perspectivas, experiencias, conocimiento';
break;
}
}
</script>

<svelte:head>
<title>{title}</title>
<meta name="description" content={description} />
<meta name="keywords" content={keywords} />
<!-- Schema.org markup for Google+ -->
<meta itemprop="name" content={title} />
<meta itemprop="description" content={description} />
<meta itemprop="image" content={avatarUrl} />
<!-- Open Graph data -->
<meta property="og:title" content={title} />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://michaelliendo.com/" />
<meta property="og:image" content={avatarUrl} />
<meta property="og:description" content={description} />
<meta property="og:site_name" content="Michael Liendo" />
<!-- Twitter Card data -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@MichaelMLiendo" />
<meta name="twitter:title" content={title} />
<meta name="twitter:description" content={description} />
<meta name="twitter:creator" content="@MichaelMLiendo" />
<meta name="twitter:image:src" content={avatarUrl} />
</svelte:head>

<ul
class="max-w-5xl m-auto flex flex-col md:grid md:grid-cols-3 md:gap-6 px-4 md:px-0"
>
{#each data.projects as project}
<Entry
title={project.title}
description={project.description}
publishDate={new Date(project.date)}
tags={project.tags}
slug={project.slug}
previewImageUrl={project.cover}
/>
{/each}
</ul>
16 changes: 16 additions & 0 deletions src/routes/[[lang=lang]]/projects/+page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/** @type {import('./$types').PageLoad} */
export async function load({ fetch }) {
const res = await fetch('/api/projects');

if (res.ok) {
const projects = await res.json();

return {
projects: projects as unknown[],
};
}

return {
projects: [],
};
}
8 changes: 8 additions & 0 deletions src/routes/api/projects/+server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { getProjects } from '$lib/utils/Notion/Notes';

/** @type {import('./$types').RequestHandler} */
export async function GET() {
const projects = await getProjects();

return new Response(JSON.stringify(projects), { status: 200 });
}