Skip to content

Commit 38a062e

Browse files
committed
Refactor collection consumers from deepDives to articles
1 parent d8cafc4 commit 38a062e

10 files changed

Lines changed: 23 additions & 30 deletions

File tree

src/components/Breadcrumbs/index.astro

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ applyRenderSentryContext({
4040
},
4141
})
4242
43-
function rewriteBreadcrumbHref(href: string): string {
44-
return href === '/deep-dive' ? '/articles' : href
45-
}
46-
4743
const breadcrumbSchema =
4844
site && breadcrumbs.length > 1
4945
? JSON.stringify({
@@ -53,7 +49,7 @@ const breadcrumbSchema =
5349
'@type': 'ListItem',
5450
position: index + 1,
5551
name: item.label,
56-
item: new URL(rewriteBreadcrumbHref(item.href), site).href,
52+
item: new URL(item.href, site).href,
5753
})),
5854
})
5955
: null
@@ -76,7 +72,7 @@ const breadcrumbSchema =
7672
</span>
7773
) : (
7874
<a
79-
href={rewriteBreadcrumbHref(item.href)}
75+
href={item.href}
8076
class="rounded px-2 py-1 text-xs text-page-inverse no-underline transition-colors bg-page-base border border-page-inverse hover:bg-secondary hover:text-content-inverse focus-visible:text-content-inverse focus-visible:bg-secondary"
8177
>
8278
{item.label}

src/components/Carousel/@types/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export type CarouselNavigationMode = 'wrap' | 'bounded'
88
export const collectionMap = {
99
'case-studies': 'caseStudies',
1010
articles: 'articles',
11-
'deep-dive': 'deepDives',
1211
} as const
1312

1413
export type CollectionMap = typeof collectionMap

src/components/Layout/Print/Cover/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Image from '@components/Image/index.astro'
77
import coverImage from './cover.jpg'
88
99
export interface Props {
10-
article: CollectionEntry<'deepDives'>
10+
article: CollectionEntry<'articles'>
1111
}
1212
1313
const { article } = Astro.props

src/components/Pages/TagPage/index.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const path = buildTagPagePath(tag, currentPage)
120120
Tagged content
121121
</h2>
122122
{paginatedContent.map(item => {
123-
const href = `/deep-dive/${item.id}`
123+
const href = `/articles/${item.id}`
124124

125125
return (
126126
<article class="group h-full relative after:pointer-events-none after:absolute after:content-[''] after:inset-0 after:rounded-none after:border-2 after:border-transparent after:opacity-0 after:transition-opacity after:duration-150 after:ease-out focus-within:after:opacity-100 focus-within:after:-inset-1.5 focus-within:after:border-spotlight">
@@ -148,7 +148,7 @@ const path = buildTagPagePath(tag, currentPage)
148148
<div class="p-6 space-y-4">
149149
<div class="flex items-center gap-3 text-sm">
150150
<span class="px-3 py-1 rounded-full text-white font-medium bg-primary">
151-
Deep Dive
151+
Article
152152
</span>
153153
<time datetime={item.data.publishDate.toISOString()}>
154154
{item.data.publishDate.toLocaleDateString('en-US', {

src/components/Search/SearchResults/client/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ const MIN_QUERY_LENGTH = 2
1717
const resultTypeLabels: Record<string, string> = {
1818
articles: 'Article',
1919
'case-studies': 'Case Study',
20-
'deep-dive': 'Deep Dive',
2120
downloads: 'Download',
2221
newsletter: 'Newsletter',
2322
services: 'Service',

src/layouts/MarkdownLayout.astro

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ export interface Props {
8080
/** Raw Markdown content from "body" property on content collection */
8181
collectionItem:
8282
| CollectionEntry<'articles'>
83-
| CollectionEntry<'deepDives'>
8483
| CollectionEntry<'services'>
8584
| CollectionEntry<'caseStudies'>
8685
| CollectionEntry<'downloads'>

src/pages/articles/index.astro

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ import PageLayout from '@layouts/PageLayout.astro'
77
import Carousel from '@components/Carousel/index.astro'
88
import Icon from '@components/Icon/index.astro'
99
10-
const allDeepDives = await getCollection('deepDives', ({ data }) => isDev() || data.isDraft !== true)
10+
const allArticles = await getCollection('articles', ({ data }) => isDev() || data.isDraft !== true)
1111
1212
const allTags = await getCollection('tags')
1313
const featuredTags = allTags.filter(tag => tag.data.featured === true)
1414
15-
const getDeepDivesForTag = (tagEntry: CollectionEntry<'tags'>) => {
16-
return allDeepDives.filter(article => {
15+
const getArticlesForTag = (tagEntry: CollectionEntry<'tags'>) => {
16+
return allArticles.filter(article => {
1717
return (article.data.tags as Array<{ id: string }>).some(tagRef => tagRef.id === tagEntry.id)
1818
})
1919
}
2020
21-
const tagsWithContent = featuredTags.filter(tag => getDeepDivesForTag(tag).length > 0)
21+
const tagsWithContent = featuredTags.filter(tag => getArticlesForTag(tag).length > 0)
2222
23-
const tagsWithNoContent = allTags.filter(tag => getDeepDivesForTag(tag).length === 0)
23+
const tagsWithNoContent = allTags.filter(tag => getArticlesForTag(tag).length === 0)
2424
2525
for (const tag of tagsWithNoContent) {
2626
console.warn(
@@ -29,7 +29,7 @@ for (const tag of tagsWithNoContent) {
2929
}
3030
3131
const pageTitle = 'Technical Index'
32-
const pageDescription = 'Browse technical deep dives structured by specific topics'
32+
const pageDescription = 'Browse technical articles structured by specific topics'
3333
const path = '/articles'
3434
---
3535

@@ -46,8 +46,8 @@ const path = '/articles'
4646
.sort((a, b) => a.data.displayName.localeCompare(b.data.displayName, 'en'))
4747
.map(tag => {
4848
const displayName = tag.data.displayName
49-
const deepDivesForTag = getDeepDivesForTag(tag)
50-
const latestDate = deepDivesForTag
49+
const articlesForTag = getArticlesForTag(tag)
50+
const latestDate = articlesForTag
5151
.map(a => a.data.publishDate)
5252
.sort((a, b) => b.getTime() - a.getTime())[0]
5353
const latestFormatted = latestDate
@@ -76,7 +76,7 @@ const path = '/articles'
7676
{displayName}
7777
</h2>
7878
<span class="shrink-0 rounded-full bg-page-inverse px-2 py-0.5 sm:ml-1 text-xs font-medium text-page-base whitespace-nowrap transition-colors group-hover:bg-page-active group-hover:text-page-base">
79-
{deepDivesForTag.length} deep dives
79+
{articlesForTag.length} articles
8080
</span>
8181
</div>
8282
</div>
@@ -96,9 +96,9 @@ const path = '/articles'
9696

9797
<Carousel
9898
variant="suggested"
99-
limit={deepDivesForTag.length}
100-
type="deep-dive"
101-
items={deepDivesForTag}
99+
limit={articlesForTag.length}
100+
type="articles"
101+
items={articlesForTag}
102102
showEmblaDots={false}
103103
showReadMore={false}
104104
/>

src/pages/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ const sectionClasses = 'container mx-auto px-4 sm:px-6 lg:px-8 py-4 md:py-8 lg:p
125125
titleHref="/articles"
126126
variant="suggested"
127127
limit={7}
128-
type="deep-dive"
128+
type="articles"
129129
showReadMore={true}
130130
/>
131131
</section>

src/pages/print/[...slug].astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ const PdfComponents = {
4747
}
4848
4949
export interface Props {
50-
article: CollectionEntry<'deepDives'>
50+
article: CollectionEntry<'articles'>
5151
}
5252
53-
/** Generate static paths for all deep-dive articles */
53+
/** Generate static paths for all articles */
5454
export async function getStaticPaths() {
5555
if (!isDev() && !GENERATE_PDFS) {
5656
return []
5757
}
5858
59-
const articleEntries = await getCollection('deepDives')
59+
const articleEntries = await getCollection('articles')
6060
6161
return articleEntries.map(article => ({
6262
params: { slug: article.id },

src/pages/rss.xml.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const toCategory = (tag: unknown) => {
1313
export async function GET() {
1414
const now = new Date()
1515
const articles = await getCollection(
16-
'deepDives',
16+
'articles',
1717
({ data }) => !data.isDraft && data.publishDate <= now
1818
)
1919
const sortedArticles = articles.sort(
@@ -34,7 +34,7 @@ export async function GET() {
3434
title: article.data.title,
3535
pubDate: article.data.publishDate,
3636
description: article.data.description,
37-
link: `/deep-dive/${article.id}`,
37+
link: `/articles/${article.id}`,
3838
categories: (article.data.tags ?? [])
3939
.map(toCategory)
4040
.filter((category): category is string => Boolean(category)),

0 commit comments

Comments
 (0)