2021-12-05 11:55:46 -09:00
|
|
|
import { Ref } from "@nuxtjs/composition-api";
|
|
|
|
import { Recipe } from "~/types/api-types/recipe";
|
|
|
|
|
2022-01-16 03:38:11 +01:00
|
|
|
export const useRecipeMeta = (recipe: Ref<Recipe | null>) => {
|
2021-12-05 11:55:46 -09:00
|
|
|
return () => {
|
2021-12-06 17:14:14 -09:00
|
|
|
const imageURL = "";
|
2021-12-05 11:55:46 -09:00
|
|
|
return {
|
2021-12-06 17:14:14 -09:00
|
|
|
title: recipe?.value?.name,
|
|
|
|
mainImage: imageURL,
|
2021-12-05 11:55:46 -09:00
|
|
|
meta: [
|
|
|
|
{ hid: "og:title", property: "og:title", content: recipe?.value?.name || "Recipe" },
|
|
|
|
{
|
|
|
|
hid: "og:desc",
|
|
|
|
property: "og:description",
|
2022-01-09 07:15:23 +01:00
|
|
|
content: recipe?.value?.description ?? "",
|
2021-12-05 11:55:46 -09:00
|
|
|
},
|
|
|
|
{
|
|
|
|
hid: "og-image",
|
|
|
|
property: "og:image",
|
2021-12-06 17:14:14 -09:00
|
|
|
content: imageURL,
|
2021-12-05 11:55:46 -09:00
|
|
|
},
|
|
|
|
{
|
|
|
|
hid: "twitter:title",
|
|
|
|
property: "twitter:title",
|
2022-01-09 07:15:23 +01:00
|
|
|
content: recipe?.value?.name ?? "",
|
2021-12-05 11:55:46 -09:00
|
|
|
},
|
|
|
|
{
|
|
|
|
hid: "twitter:desc",
|
|
|
|
property: "twitter:description",
|
2022-01-09 07:15:23 +01:00
|
|
|
content: recipe?.value?.description ?? "",
|
2021-12-05 11:55:46 -09:00
|
|
|
},
|
|
|
|
{ hid: "t-type", name: "twitter:card", content: "summary_large_image" },
|
|
|
|
],
|
|
|
|
__dangerouslyDisableSanitizers: ["script"],
|
|
|
|
script: [
|
|
|
|
{
|
|
|
|
innerHTML: JSON.stringify({
|
|
|
|
"@context": "http://schema.org",
|
|
|
|
"@type": "Recipe",
|
|
|
|
...recipe.value,
|
|
|
|
}),
|
|
|
|
type: "application/ld+json",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|