Skip to content

Commit 372b016

Browse files
add dynamic cta for feature page
1 parent 67a47d9 commit 372b016

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

pages/features/[slug].vue

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
const { $directus, $readItems } = useNuxtApp();
2+
const { $directus, $readItems, $readSingleton } = useNuxtApp();
33
const { params } = useRoute();
44
const router = useRouter();
55
@@ -37,6 +37,14 @@ const { data: allFeatures } = await useAsyncData(
3737
},
3838
);
3939
40+
const { data: footerCta } = useAsyncData('features-footer-cta', () =>
41+
$directus.request(
42+
$readSingleton('globals', {
43+
fields: ['features_page_cta'],
44+
}),
45+
),
46+
);
47+
4048
const pagination = computed(() => {
4149
if (!unref(feature) || !unref(allFeatures)) return {};
4250
const currentIndex = unref(allFeatures)?.findIndex((f) => f.sort === unref(feature)?.sort);
@@ -133,8 +141,8 @@ onMounted(() => {
133141
/>
134142
</div>
135143
</div>
136-
<div class="block-container narrow mt-16 pb-16">
137-
<BlockPaper uuid="8ce2ec0c-b939-4cb1-b4dc-8366618b9625" />
144+
<div v-if="footerCta?.features_page_cta" class="block-container narrow mt-16 pb-16">
145+
<BlockPaper :uuid="footerCta?.features_page_cta as string" />
138146
</div>
139147
</BaseContainer>
140148
</PageSection>

types/schema/meta/globals.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { BlockButtonGroup } from '../blocks/block-button-group.js';
22
import type { BlockForm } from '../blocks';
3+
import type { BlockPaper } from '../blocks/block-paper.js';
34
import type { User } from '../system/index.js';
45

56
export interface Globals {
@@ -21,4 +22,6 @@ export interface Globals {
2122
resource_sidebar_cta_header: string | null;
2223
resource_sidebar_cta_description: string | null;
2324
resource_sidebar_cta_form: string | BlockForm | null;
25+
// Features Page CTA
26+
features_page_cta: string | BlockPaper | null;
2427
}

0 commit comments

Comments
 (0)