Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 29 additions & 13 deletions src/components/Features/SearchContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
id="search-content-page-type"
type="text"
:required="true"
placeholder="page_type_1, page_type_2, etc."
v-model="pageType"
>
<template v-slot:label>Page Type</template>
Expand All @@ -41,6 +42,7 @@
v-if="searchScope === 'collections'"
id="search-content-collection-key"
type="text"
placeholder="collection_key_1, collection_key_2, etc."
:required="true"
v-model="collectionKey"
>
Expand Down Expand Up @@ -94,7 +96,7 @@
<div class="search-content__result-header search-content__result-header--desktop">
<div>
<div class="search-content__result-title-wrapper">
<Chip class="search-content__source-badge">{{ getScopeBadgeText() }}</Chip>
<Chip class="search-content__source-badge">{{ getResultSourceBadge(result) }}</Chip>
<span class="search-content__result-title">{{ result.title }}</span>
</div>
<div class="search-content__result-slug">{{ result.slug }}</div>
Expand Down Expand Up @@ -226,17 +228,24 @@ function getScopeItemNamePlural(): string {
}
}

function getScopeBadgeText(): string {
switch (searchScope.value) {
case 'pages':
return `Page (${pageType.value})`
case 'blog':
return 'Blog'
case 'collections':
return `Collection (${collectionKey.value})`
default:
return 'Unknown'
function getResultSourceBadge(
result: AsyncReturnType<typeof searchContent>['results'][number],
): string {
if (searchScope.value === 'pages' && result.sourceType) {
return `Page (${result.sourceType})`
} else if (searchScope.value === 'collections' && result.sourceType) {
return `Collection (${result.sourceType})`
} else if (searchScope.value === 'blog') {
return 'Blog'
}
return 'Unknown'
}

function parseCommaSeparatedInput(input: string): string[] {
return input
.split(',')
.map((item) => item.trim())
.filter((item) => item.length > 0)
}

// Main search execution
Expand Down Expand Up @@ -269,13 +278,20 @@ async function executeSearch(): Promise<void> {
setStatus('Searching...', 'info', true)

try {
const pageTypesArray =
searchScope.value === 'pages' ? parseCommaSeparatedInput(pageType.value) : undefined
const collectionKeysArray =
searchScope.value === 'collections'
? parseCommaSeparatedInput(collectionKey.value)
: undefined

const searchResponse = await searchContent(
searchScope.value,
searchTermValue,
token,
store.includePreview,
pageType.value.trim() || undefined,
collectionKey.value.trim() || undefined,
pageTypesArray,
collectionKeysArray,
)

if (!searchResponse.success) {
Expand Down
8 changes: 8 additions & 0 deletions src/components/WhatsNew.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ interface Feature {
const showModal = ref<boolean>(false)

const features: Feature[] = [
{
id: 'search-content-multi-types',
type: 'improvement',
title: 'Search Content utility now supports multiple page types and collection types',
description:
'The Search Content utility has been improved to allow searching across multiple page types and collection types at once, making it easier to find content that may be spread across different types. Simply use a comma-separated list of page type and collection keys in the search input to search across them all simultaneously.',
utcDatetimeAdded: new Date('2026-02-08T14:00:00Z'),
},
{
id: 'search-content-alt-text',
type: 'bugfix',
Expand Down
Loading