Browse Source

test meta tags

Olivier Massot 1 năm trước cách đây
mục cha
commit
6dfdba8426
4 tập tin đã thay đổi với 18 bổ sung8 xóa
  1. 3 3
      components/Common/Meta.vue
  2. 14 4
      components/News/Details.vue
  3. 1 1
      env/.env.docker
  4. 0 0
      error.vue.off

+ 3 - 3
components/Common/Meta.vue

@@ -10,15 +10,15 @@ import type { PropType } from 'vue'
 
 const props = defineProps({
   title: {
-    type: String as PropType<string | (() => string)>,
+    type: String,
     required: true,
   },
   description: {
-    type: String as PropType<string | (() => string)>,
+    type: String,
     required: true,
   },
   image: {
-    type: String as PropType<string | (() => string) | null>,
+    type: String,
     required: false,
     default: '/images/logos/opentalent/Logo_Opentalent-gris.png',
   },

+ 14 - 4
components/News/Details.vue

@@ -17,9 +17,12 @@
       <div v-if="newsItem">
         <div class="news">
           <CommonMeta
-            :title="() => newsItem.title!"
-            :description="() => newsItem.leadText!"
-            :image="() => getImageUrl(newsItem.attachment)"
+            :title="newsItem.title!"
+            :description="newsItem.leadText!"
+            :image="
+              getImageUrl(newsItem.attachment) ??
+              'public/images/logos/opentalent/Logo_Opentalent-gris.png'
+            "
           />
 
           <v-row class="center-90 mb-12">
@@ -46,7 +49,7 @@
           </v-row>
 
           <v-row class="center-90">
-            <p class="description" v-html="newsItem.bodyText" />
+            <p class="description" v-html="body" />
           </v-row>
 
           <v-row class="d-flex justify-center align-center">
@@ -110,6 +113,13 @@ if (!newsId || isNaN(newsId)) {
 
 const newsItem = (await em.fetch(News, newsId, true)) as News
 
+const body: Ref<string | null> = ref(null)
+
+onMounted(() => {
+  // Seule solution trouvée pour le moment pour résoudre une erreur d'hydratation...
+  body.value = newsItem.bodyText
+})
+
 const getImageUrl = (attachment: string | null): string | null => {
   if (!attachment) {
     return null

+ 1 - 1
env/.env.docker

@@ -3,7 +3,7 @@ NUXT_ENV=dev
 NUXT_DEBUG=1
 DEBUG=1
 
-NUXT_API_BASE_URL=https://nginx_maestro
+NUXT_API_BASE_URL=http://nginx_maestro
 NUXT_PUBLIC_API_BASE_URL=https://local.maestro.opentalent.fr
 
 NUXT_SITE_URL=http://local.logiciels.opentalent.fr

+ 0 - 0
error.vue → error.vue.off