Skip to content

Commit

Permalink
changes for deepsource
Browse files Browse the repository at this point in the history
  • Loading branch information
walsh9 committed Apr 13, 2023
1 parent 3027812 commit 2ce97ce
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions composables/data/basePages.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Page } from "../types/Page"

export const WAGTAIL_PAGE_TYPES = {
"gallery.GalleryPage": 'gallery',
"news.ArticlePage": 'article_page',
"standardpages.IndexPage": 'section_page',
"standardpages.InformationPage": 'information_page',
"tagpages.TagPage": 'tag_page'
}

export function normalizePage(page: Record<string, any>): Page {
return {
id: page.id,
title: page.title,
uuid: page.uuid,
type: WAGTAIL_PAGE_TYPES[page.meta?.type] || 'unknown',

listingTitle: page.listingTitle || page.title,
listingDescription: page.listingSummary || page.description,
listingImage: page.listingImage,

socialTitle: page.socialTitle || page.title,
socialDescription: page.socialText || page.description,
socialImage: page.socialImage,

seoTitle: page.meta?.seoTitle || page.title,
searchDescription: page.meta?.searchDescription || page.title
}
}

0 comments on commit 2ce97ce

Please sign in to comment.