Skip to content

Commit 2cef847

Browse files
committed
Refactor code structure for improved readability and maintainability
1 parent ec796e8 commit 2cef847

File tree

4 files changed

+486
-1
lines changed

4 files changed

+486
-1
lines changed

src/app/explore/ExploreClient.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ export default function ExploreClient({ articles }: { articles: Article[] }) {
127127
const articleChannel = getArticleChannel(article)
128128
const href = article.frontmatter.type === 'dialogue'
129129
? `/atlas/dialogue/${article.slug}`
130+
: article.frontmatter.type === 'book'
131+
? `/atlas/books/${article.slug}`
130132
: `/atlas/monologue/${article.slug}`
131133

132134
return (

src/app/sitemap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
1313

1414
const articles = await getAllArticles()
1515
const articleRoutes: MetadataRoute.Sitemap = articles.map((a) => ({
16-
url: `${baseUrl}/atlas/${a.frontmatter.type === 'dialogue' ? 'dialogue' : 'monologue'}/${a.slug}`,
16+
url: `${baseUrl}/atlas/${a.frontmatter.type === 'dialogue' ? 'dialogue' : a.frontmatter.type === 'book' ? 'books' : 'monologue'}/${a.slug}`,
1717
lastModified: new Date(a.frontmatter.date || Date.now()),
1818
changeFrequency: 'monthly',
1919
priority: 0.6,

src/components/recent-updates.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ export function RecentUpdates({ className }: RecentUpdatesProps) {
8787

8888
// Determine correct route based on channel/content type
8989
const getArticleRoute = (slug: string) => {
90+
// Check if it's a book based on slug pattern
91+
if (slug.includes('essential-') || slug.includes('-essential')) {
92+
return `/atlas/books/${slug}`;
93+
}
9094
// For now, assume dialogue if multiple authors, monologue if single
9195
const isDialogue = update.author.includes('&');
9296
return isDialogue ? `/atlas/dialogue/${slug}` : `/atlas/monologue/${slug}`;

0 commit comments

Comments
 (0)