Skip to content

Instantly share code, notes, and snippets.

@V-ed
Last active January 20, 2025 21:51
Show Gist options
  • Save V-ed/a5d93890ff07e14209c1b82954c38e01 to your computer and use it in GitHub Desktop.
Save V-ed/a5d93890ff07e14209c1b82954c38e01 to your computer and use it in GitHub Desktop.
Mealie Add Recipe Bookmarklet
var recipeUrl = new URL(document.URL);
var mealie = "https://mealie.v-ed.ca";
var group_slug = "famille";
var doUseKeywords = false; // use keywords from recipe
var stayInEditMode = true;
var decoratedUrlParams = {
"hellofresh.ca": [
{
param: "locale",
value: "fr-CA"
}
]
};
var destUrl = new URL("/g/" + group_slug + "/r/create/url", mealie);
if (doUseKeywords) {
destUrl.searchParams.set("use_keywords", "1");
}
if (stayInEditMode) {
destUrl.searchParams.set("edit", "1");
}
Object.entries(decoratedUrlParams).forEach(([urlSearchValue, paramsToAdd]) => {
if (recipeUrl.href.includes(urlSearchValue)) {
paramsToAdd.forEach(({ param, value }) => {
recipeUrl.searchParams.append(param, value);
});
}
});
destUrl.searchParams.set("recipe_import_url", recipeUrl);
window.open(destUrl, "_blank");
@V-ed
Copy link
Author

V-ed commented Jan 19, 2025

Script to import the current recipe to Mealie

Installation Steps

Go to https://caiorss.github.io/bookmarklet-maker/ and define your bookmarklet title.

Add Recipe To Mealie

Copy the script into the code box, and tweak the variables as needs be.

Press Generate Bookmarklet, then drag the blue tagged "Add recipe To Mealie" link to your favorites bar.

Usage

On any recipe website, click on the favorite you created as noted above.

You should have a new tab that opens with the recipe being imported, and should automatically move you to the next step depending on your configured vars.


Adapted from the docs' : https://docs.mealie.io/documentation/community-guide/import-recipe-bookmarklet/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment