Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic OGs Again Again 😭 #178

Merged
merged 2 commits into from
Jan 7, 2025
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
2 changes: 1 addition & 1 deletion components/OgImage/Default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ defineProps<OgProps>();
</h1>
</div>
<div v-if="publishedAt" class="flex">
<div class="text-xl text-slate-500">
<div class="text-xl text-slate-500 line-clamp-2">
{{ publishedAt }}
</div>
</div>
Expand Down
12 changes: 12 additions & 0 deletions utils/og.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ export function getOgProps(baseUrl: string, collection: string, item = {} as any
};
}

case 'templates': {
return {
...props,
title: item.name ?? 'Directus Template',
imageUrl: `${baseUrl}/${item.image?.id}?format=jpeg&width=800`,
badgeLabel: 'Directus Template',
publishedAt: item.description,
authorName: userName(item.creator),
authorImage: `${baseUrl}/${item.creator?.avatar}?format=jpeg&width=800`,
};
}

default:
return props;
}
Expand Down
Loading