Skip to content

Commit d1f1086

Browse files
committed
integrate tag filter component into Spanish blog page
1 parent 68f56a5 commit d1f1086

12 files changed

Lines changed: 222 additions & 236 deletions

File tree

eslint.config.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@ export default defineConfig([
1414
},
1515
tseslint.configs.recommended,
1616
eslintPluginAstro.configs.recommended,
17-
globalIgnores(['dist', '.astro', 'node_modules', 'public', '**/*.min.js']),
17+
globalIgnores([
18+
'dist',
19+
'.astro',
20+
'node_modules',
21+
'public',
22+
'**/*.min.js',
23+
'cms'
24+
]),
1825
{
1926
rules: {
2027
'no-console': 'error',

src/components/blog/BlogIndex.astro

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { createExcerpt } from '../../utils/create-excerpt'
33
import TagFilter from './TagFilter.astro'
44
import Pagination from './Pagination.astro'
55
import type { CollectionEntry } from 'astro:content'
6-
6+
import { useTranslations } from '../../i18n/utils'
7+
import { languages, defaultLang } from '../../i18n/ui'
78
interface BreadcrumbItem {
89
name: string
910
href: string
@@ -13,6 +14,7 @@ interface BreadcrumbItem {
1314
interface Props {
1415
title: string
1516
posts: CollectionEntry<'blog'>[]
17+
lang: keyof typeof languages
1618
breadcrumbs?: BreadcrumbItem[]
1719
allTags?: string[]
1820
selectedTag?: string
@@ -31,13 +33,16 @@ interface Props {
3133
const {
3234
title,
3335
posts,
36+
lang,
3437
breadcrumbs = [],
3538
allTags = [],
3639
selectedTag,
3740
showTagFilter = false,
3841
showPagination = false,
3942
paginationProps
4043
} = Astro.props
44+
45+
const t = useTranslations(lang)
4146
---
4247

4348
<main>
@@ -70,16 +75,25 @@ const {
7075
}
7176
<header>
7277
<h1>{title}</h1>
73-
<a class="cta__blog" href="/blog">
74-
<p>Check out Foundation updates</p>
78+
<a
79+
class="cta__blog"
80+
href={lang == defaultLang
81+
? 'https://interledger.org/blog'
82+
: `https://interledger.org/${lang}/blog`}
83+
>
84+
<p>{t('blog.check-updates')}</p>
7585
<img
7686
src="/developers/img/ernie-purple.svg"
7787
alt="Ernie holding an envelope"
7888
aria-hidden="true"
7989
/>
8090
</a>
8191
</header>
82-
{showTagFilter && <TagFilter allTags={allTags} selectedTag={selectedTag} />}
92+
{
93+
showTagFilter && (
94+
<TagFilter lang={lang} allTags={allTags} selectedTag={selectedTag} />
95+
)
96+
}
8397
<ol class="postlist">
8498
{
8599
posts.map((blogPostEntry) => {
@@ -92,26 +106,16 @@ const {
92106
>
93107
{blogPostEntry.data.date.toDateString()}
94108
</time>
95-
{blogPostEntry.data.lang ? (
96-
<div class="postlist-es">
97-
<a
98-
href={`/developers/blog/${blogPostEntry.id}`}
99-
class="postlist-link heading--6"
100-
>
101-
{blogPostEntry.data.title}
102-
</a>
103-
<a class="postlist-lang" href="/developers/blog/es">
104-
ES
105-
</a>
106-
</div>
107-
) : (
108-
<a
109-
href={`/developers/blog/${blogPostEntry.id}`}
110-
class="postlist-link heading--6"
111-
>
112-
{blogPostEntry.data.title}
113-
</a>
114-
)}
109+
<a
110+
href={
111+
lang == defaultLang
112+
? `/developers/blog/${blogPostEntry.id}`
113+
: `/developers/${lang}/blog/${blogPostEntry.id}`
114+
}
115+
class="postlist-link heading--6"
116+
>
117+
{blogPostEntry.data.title}
118+
</a>
115119
<p>
116120
{blogPostEntry.data.description
117121
? blogPostEntry.data.description
@@ -244,12 +248,6 @@ const {
244248
text-decoration-color: currentColor;
245249
}
246250

247-
.postlist-es {
248-
display: flex;
249-
align-items: start;
250-
gap: var(--space-2xs);
251-
}
252-
253251
.postlist-lang {
254252
border: 1.5px solid;
255253
padding-inline: 4px;

src/components/blog/TagFilter.astro

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,38 @@
11
---
2-
import { getTagUrl } from '../../utils/tag-url'
2+
import { useTranslations } from '../../i18n/utils'
3+
import { languages, defaultLang } from '../../i18n/ui'
4+
import { getTagSlug, getTagUrl } from '../../utils/tag-url'
35
46
interface Props {
7+
lang: keyof typeof languages
58
allTags: string[]
69
selectedTag?: string
710
}
811
9-
const { allTags, selectedTag } = Astro.props
12+
const { lang, allTags, selectedTag } = Astro.props
13+
const t = useTranslations(lang)
1014
---
1115

1216
<div class="tag-filter">
13-
<div class="tag-filter-label">Filter by tag:</div>
17+
<div class="tag-filter-label">{t('blog.filter')}:</div>
1418
<div class="tag-filter-buttons">
1519
<a
16-
href="/developers/blog"
20+
href={lang === defaultLang
21+
? '/developers/blog'
22+
: `/developers/${lang}/blog`}
1723
class:list={['tag-button', { active: !selectedTag }]}
1824
data-umami-event="Blog tag filter - All"
1925
>
20-
All
26+
{t('tag.all')}
2127
</a>
2228
{
2329
allTags.map((tag) => (
2430
<a
25-
href={getTagUrl(tag)}
31+
href={getTagUrl(tag, lang)}
2632
class:list={['tag-button', { active: selectedTag === tag }]}
2733
data-umami-event={`Blog tag filter - ${tag}`}
2834
>
29-
{tag}
35+
{t(`tag.${getTagSlug(tag)}`) ?? t(`tag.other`)}
3036
</a>
3137
))
3238
}

src/content/blog/2025-03-12-breakpoint-it-work-week.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ authors:
88
- Timea Nagy
99
author_urls:
1010
- https://www.linkedin.com/in/nagy-timea-35483024
11-
tags: []
11+
tags:
12+
- Interledger Protocol
1213
---
1314

1415
After shaking off the January blues, the Interledger Engineering Managers and Product Managers gathered with the BreakPoint IT team for a productive work week in Cluj-Napoca, Romania.

src/content/blog/es/2025-03-12-breakpoint-it-work-week.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ authors:
99
author_urls:
1010
- https://www.linkedin.com/in/nagy-timea-35483024
1111
tags:
12-
- Interledger
12+
- Interledger Protocol
1313
---
1414

1515
Después de dejar atrás la melancolía de enero, los Gerentes de Ingeniería y Gerentes de Producto de Interledger se reunieron con el equipo de BreakPoint IT para una semana de trabajo productiva en Cluj-Napoca, Rumanía.

src/i18n/ui.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,18 @@ export const ui: LanguageUi = {
5757
'footer.terms': 'Terms of Service',
5858
'footer.privacy': 'Privacy Policy',
5959
'footer.contact': 'Contact Us',
60-
'blog.written-by': 'Written by'
60+
'blog.tech-blog-title': 'Engineering Blog',
61+
'blog.check-updates': 'Check out Foundation updates',
62+
'blog.filter': 'Filter by tag',
63+
'blog.written-by': 'Written by',
64+
'tag.all': 'All',
65+
'tag.interledger-protocol': 'Interledger Protocol',
66+
'tag.open-payments': 'Open Payments',
67+
'tag.rafiki': 'Rafiki',
68+
'tag.releases': 'Releases',
69+
'tag.updates': 'Updates',
70+
'tag.web-monetization': 'Web Monetization',
71+
'tag.other': 'Other'
6172
},
6273
es: {
6374
'nav.foundation': 'Fundación',
@@ -96,6 +107,17 @@ export const ui: LanguageUi = {
96107
'footer.terms': 'Condiciones del servicio',
97108
'footer.privacy': 'Política de privacidad',
98109
'footer.contact': 'Contáctanos',
99-
'blog.written-by': 'Escrito por'
110+
'blog.tech-blog-title': 'Blog de Ingeniería',
111+
'blog.check-updates': 'Actualizaciones de la Fundación',
112+
'blog.filter': 'Filtre por etiquetas',
113+
'blog.written-by': 'Escrito por',
114+
'tag.all': 'Todas',
115+
'tag.interledger-protocol': 'Interledger Protocol',
116+
'tag.open-payments': 'Open Payments',
117+
'tag.rafiki': 'Rafiki',
118+
'tag.releases': 'Lanzamientos',
119+
'tag.updates': 'Actualizaciones',
120+
'tag.web-monetization': 'Web Monetization',
121+
'tag.other': 'Otros'
100122
}
101123
} as const

src/layouts/BlogLayout.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const rawHTMLString = `This article was originally published at <a href=${frontm
6262
href={translatePath('/developers/blog')}
6363
data-umami-event="Devs breadcrumb - Blog"
6464
>
65-
<span itemprop="name">{t('nav.tech-blog')}</span></a
65+
<span itemprop="name">{t('blog.tech-blog-title')}</span></a
6666
>
6767
<meta itemprop="position" content="2" />
6868
</li>

0 commit comments

Comments
 (0)