pickles976 / HariRecipes

Offline Searchable Recipe Database
https://hari.recipes
MIT License
8 stars 0 forks source link

Add Id+json / microdata to recipe pages #1

Open nwithan8 opened 1 week ago

nwithan8 commented 1 week ago

Hey, first off, great resource, thanks for making it!

I'm trying to import some of these recipes (e.g. https://hari.recipes/recipe/?index=168196) into my Mealie instance, and it's failing to parse the recipe page properly.

Specifically, Mealie reports the following warning:

image

Seems like it expects Id+json data on the page somewhere, or perhaps valid JSON schema.

image

For the recipe above, importing both the main page (https://hari.recipes/recipe/?index=168196) and the JSON (https://hari.recipes/recipe/json/?index=168196) failed. The source website (https://www.bigoven.com/recipe/sizzling-filet-mignon-steak-sandwich/180108) did work, but it would be great to be able to import simply from the Hari Recipe page without having to visit the source webpage.

Let me know if I can provide any additional details to hopefully get this added.

pickles976 commented 1 week ago

Hey Nate thanks for the feedback! This is a good idea. Many people have mentioned mealie integration.

I wont have the bandwidth to work on this until Thanksgiving weekend, I’m working on data cleanup atm.

If you would like to integrate this yourself, feel free to create a pull request. You’d need to add a serialization method to RecipeData, then call that serialization method in the Jinja template, inside of a script tag with the ld+json class.

https://github.com/pickles976/HariRecipes/blob/fc0a4f078b74a4f7a75ae5483140a0ea00daa65e/src/service/templating.py#L21

This is the function where the recipedata gets injected into the template.