Skip to content

Commit 5dd8e7b

Browse files
committed
feat: enhance search with goodies, about pages and navigation links
- Add search indexing for goodies and content collections - Add navigation sections with icons for Blog, Goodies, and About - Add quick links for Home, Blog, Speaking, Goodies, and About - Use appropriate icons: file-text for articles, gift for goodies, user for about
1 parent 9c96683 commit 5dd8e7b

2 files changed

Lines changed: 104 additions & 7 deletions

File tree

app/app.vue

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,66 @@ useSeoMeta({
2424
twitterCard: 'summary_large_image'
2525
})
2626
27-
const { data: files } = useLazyAsyncData('search', () => queryCollectionSearchSections('posts'), {
27+
// Query multiple collections for search (posts, goodies, and about page)
28+
const { data: postsFiles } = useLazyAsyncData('search-posts', () => queryCollectionSearchSections('posts'), {
2829
server: false
2930
})
31+
const { data: goodiesFiles } = useLazyAsyncData('search-goodies', () => queryCollectionSearchSections('goodies'), {
32+
server: false
33+
})
34+
const { data: contentFiles } = useLazyAsyncData('search-content', () => queryCollectionSearchSections('content'), {
35+
server: false
36+
})
37+
38+
// Combine all search files
39+
const files = computed(() => [
40+
...(postsFiles.value || []),
41+
...(goodiesFiles.value || []),
42+
...(contentFiles.value || [])
43+
])
3044
31-
const { data: navigation } = useLazyAsyncData('navigation', () => queryCollectionNavigation('posts'), {
45+
// Query navigation for each collection
46+
const { data: postsNavigation } = useLazyAsyncData('navigation-posts', () => queryCollectionNavigation('posts'), {
3247
server: false
3348
})
49+
const { data: goodiesNavigation } = useLazyAsyncData('navigation-goodies', () => queryCollectionNavigation('goodies'), {
50+
server: false
51+
})
52+
const { data: contentNavigation } = useLazyAsyncData('navigation-content', () => queryCollectionNavigation('content'), {
53+
server: false
54+
})
55+
56+
// Helper to add icon to navigation items
57+
const addIconToItems = (items: any[] | undefined, icon: string) =>
58+
(items || []).map(item => ({ ...item, icon }))
59+
60+
// Combine navigation with proper section labels and icons on each item
61+
const navigation = computed(() => [
62+
{ title: 'Blog', icon: 'i-lucide-file-text', path: '/posts', children: addIconToItems(postsNavigation.value?.find(item => item.path === '/posts')?.children || postsNavigation.value, 'i-lucide-file-text') },
63+
{ title: 'Goodies', icon: 'i-lucide-gift', path: '/goodies', children: addIconToItems(goodiesNavigation.value, 'i-lucide-gift') },
64+
{ title: 'About', icon: 'i-lucide-user', path: '/about', children: addIconToItems(contentNavigation.value?.filter(item => item.path === '/about'), 'i-lucide-user') }
65+
])
3466
3567
const links = [{
68+
label: 'Home',
69+
icon: 'i-lucide-home',
70+
to: '/'
71+
}, {
3672
label: 'Blog',
37-
icon: 'i-lucide-pencil',
73+
icon: 'i-lucide-file-text',
3874
to: '/posts'
75+
}, {
76+
label: 'Speaking',
77+
icon: 'i-lucide-mic',
78+
to: '/speaking'
79+
}, {
80+
label: 'Goodies',
81+
icon: 'i-lucide-gift',
82+
to: '/goodies'
83+
}, {
84+
label: 'About',
85+
icon: 'i-lucide-user',
86+
to: '/about'
3987
}]
4088
4189
// Use the content search composable

app/error.vue

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,66 @@ useSeoMeta({
1919
description: 'We are sorry but this page could not be found.'
2020
})
2121
22-
const { data: navigation } = await useAsyncData('navigation', () => queryCollectionNavigation('posts'), {
23-
transform: data => data.find(item => item.path === '/posts')?.children || []
22+
// Query navigation for each collection
23+
const { data: postsNavigation } = useLazyAsyncData('navigation-posts', () => queryCollectionNavigation('posts'), {
24+
server: false
25+
})
26+
const { data: goodiesNavigation } = useLazyAsyncData('navigation-goodies', () => queryCollectionNavigation('goodies'), {
27+
server: false
2428
})
25-
const { data: files } = useLazyAsyncData('search', () => queryCollectionSearchSections('posts'), {
29+
const { data: contentNavigation } = useLazyAsyncData('navigation-content', () => queryCollectionNavigation('content'), {
2630
server: false
2731
})
2832
33+
// Helper to add icon to navigation items
34+
const addIconToItems = (items: any[] | undefined, icon: string) =>
35+
(items || []).map(item => ({ ...item, icon }))
36+
37+
// Combine navigation with proper section labels and icons on each item
38+
const navigation = computed(() => [
39+
{ title: 'Blog', icon: 'i-lucide-file-text', path: '/posts', children: addIconToItems(postsNavigation.value?.find(item => item.path === '/posts')?.children || postsNavigation.value, 'i-lucide-file-text') },
40+
{ title: 'Goodies', icon: 'i-lucide-gift', path: '/goodies', children: addIconToItems(goodiesNavigation.value, 'i-lucide-gift') },
41+
{ title: 'About', icon: 'i-lucide-user', path: '/about', children: addIconToItems(contentNavigation.value?.filter(item => item.path === '/about'), 'i-lucide-user') }
42+
])
43+
44+
// Query multiple collections for search (posts, goodies, and about page)
45+
const { data: postsFiles } = useLazyAsyncData('search-posts', () => queryCollectionSearchSections('posts'), {
46+
server: false
47+
})
48+
const { data: goodiesFiles } = useLazyAsyncData('search-goodies', () => queryCollectionSearchSections('goodies'), {
49+
server: false
50+
})
51+
const { data: contentFiles } = useLazyAsyncData('search-content', () => queryCollectionSearchSections('content'), {
52+
server: false
53+
})
54+
55+
// Combine all search files
56+
const files = computed(() => [
57+
...(postsFiles.value || []),
58+
...(goodiesFiles.value || []),
59+
...(contentFiles.value || [])
60+
])
61+
2962
const links = [{
63+
label: 'Home',
64+
icon: 'i-lucide-home',
65+
to: '/'
66+
}, {
3067
label: 'Blog',
31-
icon: 'i-lucide-pencil',
68+
icon: 'i-lucide-file-text',
3269
to: '/posts'
70+
}, {
71+
label: 'Speaking',
72+
icon: 'i-lucide-mic',
73+
to: '/speaking'
74+
}, {
75+
label: 'Goodies',
76+
icon: 'i-lucide-gift',
77+
to: '/goodies'
78+
}, {
79+
label: 'About',
80+
icon: 'i-lucide-user',
81+
to: '/about'
3382
}]
3483
</script>
3584

0 commit comments

Comments
 (0)