File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ useHead({
1919
2020useSeoMeta ({
2121 titleTemplate: ' %s - Alexandre Nédélec' ,
22- ogImage: ' /images/ social-card.png' ,
23- twitterImage: ' /images/ social-card.png' ,
22+ ogImage: ' /social-card.png' ,
23+ twitterImage: ' /social-card.png' ,
2424 twitterCard: ' summary_large_image'
2525})
2626
Original file line number Diff line number Diff line change 11<script setup lang="ts">
2+ import { joinURL } from ' ufo'
3+
24const route = useRoute ()
35
46const { data : goodie } = await useAsyncData (route .path , () => queryCollection (' goodies' ).path (route .path ).first ())
@@ -22,9 +24,12 @@ useSeoMeta({
2224 ogDescription: description
2325})
2426
27+ // OG Image: use goodie cover image if available, otherwise generate one
2528if (goodie .value .image ?.src ) {
26- defineOgImage ({
27- url: goodie .value .image .src
29+ const site = useSiteConfig ()
30+ useSeoMeta ({
31+ ogImage: joinURL (site .url , goodie .value .image .src ),
32+ twitterImage: joinURL (site .url , goodie .value .image .src )
2833 })
2934} else {
3035 defineOgImageComponent (' Saas' , {
Original file line number Diff line number Diff line change 11<script setup lang="ts">
2+ import { joinURL } from ' ufo'
3+
24const route = useRoute ()
35
46const { data : post } = await useAsyncData (route .path , () => queryCollection (' posts' ).path (route .path ).first ())
@@ -38,9 +40,12 @@ useSchemaOrg([
3840 })
3941])
4042
43+ // OG Image: use post cover image if available, otherwise generate one
4144if (post .value .image ?.src ) {
42- defineOgImage ({
43- url: post .value .image .src
45+ const site = useSiteConfig ()
46+ useSeoMeta ({
47+ ogImage: joinURL (site .url , post .value .image .src ),
48+ twitterImage: joinURL (site .url , post .value .image .src )
4449 })
4550} else {
4651 defineOgImageComponent (' Saas' , {
@@ -54,7 +59,7 @@ if (post.value.image?.src) {
5459 <NuxtImg
5560 v-if =" post.image?.src"
5661 :src =" post.image.src"
57- :alt =" post.image.alt || post. title"
62+ :alt =" post.title"
5863 class =" post-cover-image w-full rounded-lg shadow-lg mb-8"
5964 />
6065
You can’t perform that action at this time.
0 commit comments