-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
415 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export const defaultLang = 'en'; | ||
|
||
export const ui = { | ||
en: { | ||
'nav.about': 'About', | ||
'nav.blog': 'Blog', | ||
'nav.work': 'Work', | ||
'nav.talks': 'Talks', | ||
'nav.community': 'Community', | ||
'nav.projects': 'Projects' | ||
}, | ||
es: { | ||
'nav.about': 'Sobre mi', | ||
'nav.work': 'Trabajo', | ||
'nav.talks': 'Charlas', | ||
'nav.community': 'Comunidad', | ||
'nav.projects': 'Proyectos' | ||
}, | ||
} as const; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { ui, defaultLang } from './ui'; | ||
|
||
export function useTranslations(lang: string = 'es') { | ||
return function t(key: keyof typeof ui[typeof defaultLang]) { | ||
// @ts-ignore | ||
return ui[lang][key] || ui[defaultLang][key]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
import BaseLayout from '@layouts/BaseLayout.astro'; | ||
import { getEntry } from 'astro:content'; | ||
const pageTitle = "About"; | ||
const aboutContent = await getEntry('blocks', 'about'); | ||
const { Content } = await aboutContent.render(); | ||
--- | ||
|
||
<BaseLayout pageTitle={pageTitle}> | ||
<Content /> | ||
</BaseLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
import type { InferGetStaticPropsType, GetStaticPaths } from 'astro'; | ||
import { getCollection } from 'astro:content'; | ||
import BaseLayout from '@layouts/BaseLayout.astro'; | ||
import BlogTags from '@components/BlogTags.astro'; | ||
import { dateFormat } from 'src/scripts/dateFormat'; | ||
export const getStaticPaths = (async () => { | ||
const blogEntries = await getCollection('blog'); | ||
return blogEntries.map(entry => ({ | ||
params: { slug: entry.slug }, props: { entry }, | ||
})); | ||
}) satisfies GetStaticPaths | ||
type Props = InferGetStaticPropsType<typeof getStaticPaths>; | ||
const { entry } = Astro.props; | ||
const { Content } = await entry.render(); | ||
--- | ||
<BaseLayout pageTitle={entry.data.title}> | ||
<p>{dateFormat.format(entry.data.date)}</p> | ||
{entry.data.image && | ||
<img src={entry.data.image} width="300" alt="Featured image" /> | ||
} | ||
<BlogTags route="/en/blog/tags/" tags={entry.data.tags} /> | ||
<Content /> | ||
|
||
{entry.data.gist && | ||
<script src={`${entry.data.gist}.js`} is:inline></script> | ||
} | ||
|
||
</BaseLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
import BaseLayout from '@layouts/BaseLayout.astro' | ||
import BlogPost from '@components/BlogPost.astro'; | ||
import { getCollection } from 'astro:content'; | ||
import BlogTags from '@components/BlogTags.astro'; | ||
import { enDateFormat } from 'src/scripts/dateFormat'; | ||
const allPosts = (await getCollection('blog')).reverse(); | ||
const tags = [...new Set(allPosts.map((post) => post.data.tags).flat())]; | ||
const pageTitle = "Blog"; | ||
--- | ||
<BaseLayout pageTitle={pageTitle}> | ||
<BlogTags route="/en/blog/tags/" tags={tags} /> | ||
<div class="post-list"> | ||
{allPosts.map((post) => <BlogPost url={`/en/blog/${post.slug}`} title={post.data.title} date={enDateFormat.format(post.data.date)} />)} | ||
</div> | ||
</BaseLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
import type { InferGetStaticParamsType, InferGetStaticPropsType, GetStaticPaths } from 'astro'; | ||
import BaseLayout from '@layouts/BaseLayout.astro'; | ||
import BlogPost from '@components/BlogPost.astro'; | ||
import { getCollection } from 'astro:content'; | ||
import { enDateFormat } from 'src/scripts/dateFormat'; | ||
import BlogTags from '@components/BlogTags.astro'; | ||
export const getStaticPaths = (async () => { | ||
const allPosts = (await getCollection('blog')).reverse(); | ||
const uniqueTags = [...new Set(allPosts.map((post) => post.data.tags).flat())]; | ||
return uniqueTags.map((tag) => { | ||
const filteredPosts = allPosts.filter((post) => post.data.tags.includes(tag)); | ||
return { | ||
params: { tag }, | ||
props: { posts: filteredPosts, tags: uniqueTags }, | ||
}; | ||
}); | ||
}) satisfies GetStaticPaths | ||
type Params = InferGetStaticParamsType<typeof getStaticPaths>; | ||
type Props = InferGetStaticPropsType<typeof getStaticPaths>; | ||
const { tag } = Astro.params as Params; | ||
const { posts, tags } = Astro.props as Props; | ||
--- | ||
<BaseLayout pageTitle={tag}> | ||
<BlogTags route="/en/blog/tags/" tags={tags} current={tag}/> | ||
<p>Blog tagged with {tag}</p> | ||
<div class="post-list"> | ||
{posts.map((post) => <BlogPost url={`/en/blog/${post.slug}`} title={post.data.title} date={enDateFormat.format(post.data.date)} />)} | ||
</div> | ||
</BaseLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
import type { InferGetStaticPropsType, GetStaticPaths } from 'astro'; | ||
import { getCollection } from 'astro:content'; | ||
import BaseLayout from '@layouts/BaseLayout.astro'; | ||
import BlogTags from '@components/BlogTags.astro'; | ||
import ResponsiveIframe from '@components/ResponsiveIframe.astro'; | ||
import { enDateFormat } from 'src/scripts/dateFormat'; | ||
export const getStaticPaths = (async () => { | ||
const blogEntries = await getCollection('talk'); | ||
return blogEntries.map(entry => ({ | ||
params: { slug: entry.slug }, props: { entry }, | ||
})); | ||
}) satisfies GetStaticPaths | ||
type Props = InferGetStaticPropsType<typeof getStaticPaths>; | ||
const { entry } = Astro.props; | ||
const { Content } = await entry.render(); | ||
--- | ||
<BaseLayout pageTitle={entry.data.title}> | ||
{entry.data.video && | ||
<ResponsiveIframe | ||
width="100%" | ||
height="600" | ||
src={entry.data.video} | ||
frameBorder="0" | ||
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" | ||
allowFullScreen | ||
title={`Video of talk ${entry.data.title}`} | ||
/> | ||
} | ||
<p>{enDateFormat.format(entry.data.date)}</p> | ||
|
||
<Content /> | ||
{entry.data.slide && | ||
<ResponsiveIframe | ||
src={entry.data.slide} | ||
width="100%" | ||
height="600" | ||
frameBorder="0" | ||
title={`Slides of talk ${entry.data.title}`} | ||
/> | ||
|
||
} | ||
|
||
{entry.data.gist && | ||
<script src={`${entry.data.gist}.js`} is:inline></script> | ||
} | ||
|
||
<BlogTags route="/en/charla/tags/" tags={entry.data.tags} /> | ||
|
||
</BaseLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
import BaseLayout from '@layouts/BaseLayout.astro' | ||
import BlogPost from '@components/BlogPost.astro'; | ||
import { getCollection } from 'astro:content'; | ||
import BlogTags from '@components/BlogTags.astro'; | ||
import { enDateFormat } from 'src/scripts/dateFormat'; | ||
const allPosts = (await getCollection('talk')).reverse(); | ||
const tags = [...new Set(allPosts.map((post) => post.data.tags).flat())]; | ||
const pageTitle = "Talks"; | ||
--- | ||
<BaseLayout pageTitle={pageTitle}> | ||
<BlogTags route="/en/charla/tags/" tags={tags} /> | ||
<div class="post-list"> | ||
{allPosts.map((post) => | ||
<BlogPost | ||
image={post.data.image} | ||
url={`/en/charla/${post.slug}`} | ||
title={post.data.title} | ||
date={enDateFormat.format(post.data.date)} | ||
/> | ||
)} | ||
</div> | ||
</BaseLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
import type { InferGetStaticParamsType, InferGetStaticPropsType, GetStaticPaths } from 'astro'; | ||
import BaseLayout from '@layouts/BaseLayout.astro'; | ||
import BlogPost from '@components/BlogPost.astro'; | ||
import { getCollection } from 'astro:content'; | ||
import { enDateFormat } from 'src/scripts/dateFormat'; | ||
import BlogTags from '@components/BlogTags.astro'; | ||
export const getStaticPaths = (async () => { | ||
const allPosts = (await getCollection('talk')).reverse(); | ||
const uniqueTags = [...new Set(allPosts.map((post) => post.data.tags).flat())]; | ||
return uniqueTags.map((tag) => { | ||
const filteredPosts = allPosts.filter((post) => post.data.tags.includes(tag)); | ||
return { | ||
params: { tag }, | ||
props: { posts: filteredPosts, tags: uniqueTags }, | ||
}; | ||
}); | ||
}) satisfies GetStaticPaths | ||
type Params = InferGetStaticParamsType<typeof getStaticPaths>; | ||
type Props = InferGetStaticPropsType<typeof getStaticPaths>; | ||
const { tag } = Astro.params as Params; | ||
const { posts, tags } = Astro.props as Props; | ||
--- | ||
<BaseLayout pageTitle={tag}> | ||
<BlogTags route="/en/charla/tags/" tags={tags} current={tag}/> | ||
<p>Talks tagged with {tag}</p> | ||
<div class="post-list"> | ||
{posts.map((post) => | ||
<BlogPost | ||
image={post.data.image} | ||
url={`/en/charla/${post.slug}`} | ||
title={post.data.title} | ||
date={enDateFormat.format(post.data.date)} | ||
/> | ||
)} | ||
</div> | ||
</BaseLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
import { getCollection } from 'astro:content'; | ||
import BaseLayout from '@layouts/BaseLayout.astro'; | ||
import { Image } from "astro:assets"; | ||
import Gallery from '@components/Gallery.astro'; | ||
// 1. Generate a new path for every collection entry | ||
export async function getStaticPaths() { | ||
const entries = await getCollection('community'); | ||
return entries.map(entry => ({ | ||
params: { slug: entry.slug }, props: { entry }, | ||
})); | ||
} | ||
// 2. For your template, you can get the entry directly from the prop | ||
const { entry } = Astro.props; | ||
const { Content } = await entry.render(); | ||
--- | ||
<BaseLayout pageTitle={entry.data.title}> | ||
<Image src={entry.data.image} alt="featured image" /> | ||
<dl> | ||
<dt>Role:</dt><dd>{entry.data.role}</dd> | ||
<dt>Responsabilities:</dt><dd>{entry.data.responsibilities}</dd> | ||
</dl> | ||
<p><em>{entry.data.excerpt}</em></p> | ||
<a href={entry.data.website}>Website</a> | ||
<Content /> | ||
{entry.data.gallery && | ||
<Gallery items={entry.data.gallery}/> | ||
} | ||
</BaseLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
import BaseLayout from '@layouts/BaseLayout.astro' | ||
import BlogPost from '@components/BlogPost.astro'; | ||
import { getCollection } from 'astro:content'; | ||
const allPosts = await getCollection('community'); | ||
const pageTitle = "Community"; | ||
--- | ||
<BaseLayout pageTitle={pageTitle}> | ||
<div class="post-list"> | ||
{allPosts.map((post) => | ||
<BlogPost | ||
url={`/en/comunidad/${post.slug}`} | ||
title={post.data.title} | ||
> | ||
<p>{post.data.role}</p> | ||
<p>{post.data.responsibilities}</p> | ||
</BlogPost> | ||
)} | ||
</div> | ||
</BaseLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
import { getCollection } from 'astro:content'; | ||
import BaseLayout from '@layouts/BaseLayout.astro'; | ||
import { Image } from "astro:assets"; | ||
import Gallery from '@components/Gallery.astro'; | ||
// 1. Generate a new path for every collection entry | ||
export async function getStaticPaths() { | ||
const entries = await getCollection('projects'); | ||
return entries.map(entry => ({ | ||
params: { slug: entry.slug }, props: { entry }, | ||
})); | ||
} | ||
// 2. For your template, you can get the entry directly from the prop | ||
const { entry } = Astro.props; | ||
const { Content } = await entry.render(); | ||
--- | ||
<BaseLayout pageTitle={entry.data.title}> | ||
<Image src={entry.data.image} alt="featured image" /> | ||
<p><em>{entry.data.excerpt}</em></p> | ||
<a href={entry.data.website}>Sitio web</a> | ||
<dl> | ||
<dt>Role:</dt><dd>{entry.data.role}</dd> | ||
<dt>Responsabilities:</dt><dd>{entry.data.responsibilities}</dd> | ||
</dl> | ||
<Content /> | ||
{entry.data.gallery && | ||
<Gallery items={entry.data.gallery}/> | ||
} | ||
</BaseLayout> |
Oops, something went wrong.