1
0
Fork 0
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:
Hayden 2021-12-05 11:55:46 -09:00 committed by GitHub
parent ba4107348f
commit b2673d75bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 914 additions and 199 deletions

View file

@ -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";

View 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",
},
],
};
};
};