Skip to content

Commit

Permalink
refactor: remove UUID resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Feb 3, 2025
1 parent 25fd513 commit 8e1ff82
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 42 deletions.
29 changes: 0 additions & 29 deletions components/Kirby/UuidResolver.ts

This file was deleted.

9 changes: 3 additions & 6 deletions pages/[...slug].vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
import { getPageQuery } from '~/queries'
const { locale } = useI18n()
const { locale, localeCodes } = useI18n()
const route = useRoute()
// Use current slug or fall back to the homepage
const pageUri = getNonLocalizedSlug(
route.params.slug,
useKirbyStaticData().languages,
)
// Extract the non-localized slug
const pageUri = getNonLocalizedSlug(route.params.slug, localeCodes.value)
const { data: pageData, error: pageError } = await useKql(
getPageQuery(pageUri || 'home'),
Expand Down
6 changes: 0 additions & 6 deletions queries/about.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ export const aboutQuery: KirbyQuerySchema = {
email: true,
phone: true,
social: 'page.social.toStructure',
// Retrieve all images from the page to resolve a UUID from
// e.g. a structure field to a file object
// images: {
// query: 'page.files.template("image")',
// select: ['uuid', 'srcset', 'width', 'height', 'alt'],
// },
...sharedQuerySelects,
},
}
2 changes: 1 addition & 1 deletion utils/locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function getNonLocalizedSlug(
if (Array.isArray(param)) {
param = param.filter(Boolean)

// If the first item is a locale, remove it
// Remove locale prefix if present
if (param.length > 0 && locales.includes(param[0])) {
param = param.slice(1)
}
Expand Down

0 comments on commit 8e1ff82

Please sign in to comment.