mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-02 20:15:24 +02:00
Feature/shareable recipes (#866)
* simplify context menu * move computed to comp-api * feat: ✨ create share tokens for recipes for sharing recieps to non-users * feat: ✨ shareable recipe links with og tags
This commit is contained in:
parent
ba4107348f
commit
b2673d75bf
25 changed files with 914 additions and 199 deletions
|
@ -7,3 +7,4 @@ export { useTags, useCategories, allCategories, allTags } from "./use-tags-categ
|
|||
export { parseIngredientText } from "./use-recipe-ingredients";
|
||||
export { useRecipeSearch } from "./use-recipe-search";
|
||||
export { useTools } from "./use-recipe-tools";
|
||||
export { useRecipeMeta } from "./use-recipe-meta";
|
||||
|
|
50
frontend/composables/recipes/use-recipe-meta.ts
Normal file
50
frontend/composables/recipes/use-recipe-meta.ts
Normal file
|
@ -0,0 +1,50 @@
|
|||
import { Ref } from "@nuxtjs/composition-api";
|
||||
import { useStaticRoutes } from "../api";
|
||||
import { Recipe } from "~/types/api-types/recipe";
|
||||
|
||||
export const useRecipeMeta = (recipe: Ref<Recipe>) => {
|
||||
const { recipeImage } = useStaticRoutes();
|
||||
console.log(recipe.value);
|
||||
return () => {
|
||||
return {
|
||||
title: recipe?.value?.name || "Recipe",
|
||||
// @ts-ignore
|
||||
mainImage: recipeImage(recipe?.value?.image),
|
||||
meta: [
|
||||
{ hid: "og:title", property: "og:title", content: recipe?.value?.name || "Recipe" },
|
||||
{
|
||||
hid: "og:desc",
|
||||
property: "og:description",
|
||||
content: recipe?.value?.description || "",
|
||||
},
|
||||
{
|
||||
hid: "og-image",
|
||||
property: "og:image",
|
||||
content: recipeImage(recipe?.value?.image || ""),
|
||||
},
|
||||
{
|
||||
hid: "twitter:title",
|
||||
property: "twitter:title",
|
||||
content: recipe?.value?.name || "Recipe",
|
||||
},
|
||||
{
|
||||
hid: "twitter:desc",
|
||||
property: "twitter:description",
|
||||
content: recipe?.value?.description || "",
|
||||
},
|
||||
{ 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",
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue